fix(treesitter): language.add - only register parser if it exists

Fixes: #24531
This commit is contained in:
L Lllvvuu 2023-09-14 00:08:43 -07:00 committed by Lewis Russell
parent eecddd2416
commit a4743487b7

View File

@ -82,9 +82,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
@ -102,6 +101,7 @@ function M.add(lang, opts)
end
vim._ts_add_language(path, lang, symbol_name)
M.register(lang, filetype)
end
--- @param x string|string[]