fix(treesitter): use tree range instead of tree root node range

This commit is contained in:
altermo
2024-04-10 10:52:51 +02:00
committed by Lewis Russell
parent 81fc27124b
commit 00e6651880
3 changed files with 27 additions and 7 deletions

View File

@ -1100,7 +1100,14 @@ end
---@param range Range
---@return boolean
local function tree_contains(tree, range)
return Range.contains({ tree:root():range() }, range)
local tree_ranges = tree:included_ranges(false)
return Range.contains({
tree_ranges[1][1],
tree_ranges[1][2],
tree_ranges[#tree_ranges][3],
tree_ranges[#tree_ranges][4],
}, range)
end
--- Determines whether {range} is contained in the |LanguageTree|.