Skip to content

Commit

Permalink
fix: add desc node for child_containing_descendant
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Oct 2, 2024
1 parent 17d9c1a commit ddbc09b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/treesitter-context/context.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ local function get_parent_nodes(langtree, range)
local ret = {} --- @type TSNode[]

if root.child_containing_descendant ~= nil then
local p = root
local p = root --- @type TSNode?
while p do
table.insert(ret, 1, p)
p = p:child_containing_descendant(n)
end
table.insert(ret, 1, n)
else
while n do
ret[#ret + 1] = n
Expand Down

0 comments on commit ddbc09b

Please sign in to comment.