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)
ft = vim.split(ft, ".", true)[1]
return ft_to_parsername[ft] or ft
local result = ft_to_parsername[ft]
if result then
return result
else
ft = vim.split(ft, ".", true)[1]
return ft_to_parsername[ft] or ft
end
end
function M.available_parsers()