mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-06 13:30:01 -04:00
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:
parent
89b3b77033
commit
da5920f2bf
1 changed files with 7 additions and 2 deletions
|
|
@ -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()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue