mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
Merge pull request #25122 from neovim/backport-25121-to-release-0.9
[Backport release-0.9] fix(treesitter): fixup for InspectTree
This commit is contained in:
@@ -102,16 +102,18 @@ function TSPlayground:new(bufnr, lang)
|
|||||||
-- the root in the child tree to the {injections} table.
|
-- the root in the child tree to the {injections} table.
|
||||||
local root = parser:parse()[1]:root()
|
local root = parser:parse()[1]:root()
|
||||||
local injections = {} ---@type table<integer,table>
|
local injections = {} ---@type table<integer,table>
|
||||||
parser:for_each_tree(function(tree, ltree)
|
for _, child in pairs(parser:children()) do
|
||||||
local r = tree:root()
|
child:for_each_tree(function(tree, ltree)
|
||||||
local node = root:named_descendant_for_range(r:range())
|
local r = tree:root()
|
||||||
if node then
|
local node = root:named_descendant_for_range(r:range())
|
||||||
injections[node:id()] = {
|
if node then
|
||||||
lang = ltree:lang(),
|
injections[node:id()] = {
|
||||||
root = r,
|
lang = ltree:lang(),
|
||||||
}
|
root = r,
|
||||||
end
|
}
|
||||||
end)
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
local nodes = traverse(root, 0, parser:lang(), injections, {})
|
local nodes = traverse(root, 0, parser:lang(), injections, {})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user