mirror of
https://github.com/neovim/neovim.git
synced 2026-03-06 17:17:21 +00:00
fix(treesitter): support multiple @injection.content captures
Before, only the last capture's range would be counted for injection.
Now all captured ranges will be counted in the ranges array. This is
more intuitive, and also provides a nice solution/alternative to the
"scoped injections" issue.
(cherry picked from commit 8b41df185c)
This commit is contained in:
committed by
github-actions[bot]
parent
8183eb32e1
commit
dfeec113be
@@ -956,7 +956,9 @@ function LanguageTree:_get_injection(match, metadata)
|
||||
local ft = vim.filetype.match({ filename = text })
|
||||
lang = ft and resolve_lang(ft)
|
||||
elseif name == 'injection.content' then
|
||||
ranges = get_node_ranges(node, self._source, metadata[id], include_children)
|
||||
for _, range in ipairs(get_node_ranges(node, self._source, metadata[id], include_children)) do
|
||||
ranges[#ranges + 1] = range
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user