mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 13:15:09 -07:00
[Backport release-0.9] fix(treesitter): language.add - only register parser if it exists
Backport of #25151. Fixes: #24531
This commit is contained in:
parent
d1813f73b8
commit
f0898d438e
@ -77,9 +77,8 @@ function M.add(lang, opts)
|
||||
filetype = { filetype, { 'string', 'table' }, true },
|
||||
})
|
||||
|
||||
M.register(lang, filetype)
|
||||
|
||||
if vim._ts_has_language(lang) then
|
||||
M.register(lang, filetype)
|
||||
return
|
||||
end
|
||||
|
||||
@ -97,6 +96,7 @@ function M.add(lang, opts)
|
||||
end
|
||||
|
||||
vim._ts_add_language(path, lang, symbol_name)
|
||||
M.register(lang, filetype)
|
||||
end
|
||||
|
||||
--- @private
|
||||
|
Loading…
Reference in New Issue
Block a user