fix(treesitter): do not error on empty filetype

Ignore instead
This commit is contained in:
Lewis Russell
2023-03-10 10:12:57 +00:00
parent 4f75960660
commit adfa9de8eb
2 changed files with 3 additions and 16 deletions

View File

@ -60,16 +60,6 @@ function M.add(lang, opts)
filetype = { filetype, { 'string', 'table' }, true },
})
if filetype == '' then
error(string.format("'%s' is not a valid filetype", filetype))
elseif type(filetype) == 'table' then
for _, f in ipairs(filetype) do
if f == '' then
error(string.format("'%s' is not a valid filetype", filetype))
end
end
end
M.register(lang, filetype or lang)
if vim._ts_has_language(lang) then
@ -109,7 +99,9 @@ function M.register(lang, filetype)
end
for _, f in ipairs(filetypes) do
ft_to_lang[f] = lang
if f ~= '' then
ft_to_lang[f] = lang
end
end
end