mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 05:05:00 -07:00
fix(treesitter): language.add
- only register parser if it exists
Fixes: #24531
This commit is contained in:
parent
eecddd2416
commit
a4743487b7
@ -82,9 +82,8 @@ function M.add(lang, opts)
|
|||||||
filetype = { filetype, { 'string', 'table' }, true },
|
filetype = { filetype, { 'string', 'table' }, true },
|
||||||
})
|
})
|
||||||
|
|
||||||
M.register(lang, filetype)
|
|
||||||
|
|
||||||
if vim._ts_has_language(lang) then
|
if vim._ts_has_language(lang) then
|
||||||
|
M.register(lang, filetype)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -102,6 +101,7 @@ function M.add(lang, opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
vim._ts_add_language(path, lang, symbol_name)
|
vim._ts_add_language(path, lang, symbol_name)
|
||||||
|
M.register(lang, filetype)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param x string|string[]
|
--- @param x string|string[]
|
||||||
|
Loading…
Reference in New Issue
Block a user