Ensure ft_to_lang supports multipart filetypes.

This allows a given parser to directly implement a multipart filetype
(like `glimmer` parser does for `html.handlebars`).

If an exact match for the current filetype is found in the lookup table,
it will be used; otherwise we look for just the first segment.
This commit is contained in:
Robert Jackson 2021-11-03 11:56:23 -04:00 committed by Santos Gallegos
parent 89b3b77033
commit da5920f2bf

View file

@ -767,8 +767,13 @@ local M = {
} }
function M.ft_to_lang(ft) function M.ft_to_lang(ft)
ft = vim.split(ft, ".", true)[1] local result = ft_to_parsername[ft]
return ft_to_parsername[ft] or ft if result then
return result
else
ft = vim.split(ft, ".", true)[1]
return ft_to_parsername[ft] or ft
end
end end
function M.available_parsers() function M.available_parsers()