mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 19:46:58 -04:00
fix: invalid cursor pos for tree root
Also adds the `program` node to lua locals.
This commit is contained in:
parent
307c78aa1e
commit
d233ec4554
2 changed files with 6 additions and 0 deletions
|
|
@ -8,6 +8,11 @@ local function node_range_to_vim(node)
|
|||
|
||||
local start_row, start_col, end_row, end_col = node:range()
|
||||
|
||||
if end_row + 1 > vim.fn.line('$') then
|
||||
end_row = vim.fn.line('$') - 1
|
||||
end_col = #vim.fn.getline('$') - 1
|
||||
end
|
||||
|
||||
local select_range = [[
|
||||
call cursor(%d, %d)
|
||||
normal v
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
((for_in_statement) @scope)
|
||||
((repeat_statement) @scope)
|
||||
((while_statement) @scope)
|
||||
((program) @scope)
|
||||
|
||||
;;; REFERENCES
|
||||
((identifier) @reference)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue