mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
fix: trees() may not be list-like
This commit is contained in:
parent
1233138586
commit
58c8682290
1 changed files with 2 additions and 2 deletions
|
|
@ -173,7 +173,7 @@ function M.get_node_at_cursor(winnr, ignore_injected_langs)
|
|||
|
||||
local root ---@type TSNode|nil
|
||||
if ignore_injected_langs then
|
||||
for _, tree in ipairs(root_lang_tree:trees()) do
|
||||
for _, tree in pairs(root_lang_tree:trees()) do
|
||||
local tree_root = tree:root()
|
||||
if tree_root and ts.is_in_node_range(tree_root, cursor_range[1], cursor_range[2]) then
|
||||
root = tree_root
|
||||
|
|
@ -202,7 +202,7 @@ function M.get_root_for_position(line, col, root_lang_tree)
|
|||
|
||||
local lang_tree = root_lang_tree:language_for_range { line, col, line, col }
|
||||
|
||||
for _, tree in ipairs(lang_tree:trees()) do
|
||||
for _, tree in pairs(lang_tree:trees()) do
|
||||
local root = tree:root()
|
||||
|
||||
if root and ts.is_in_node_range(root, line, col) then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue