mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -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)
|
||||
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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue