fix: invalid cursor pos for tree root

Also adds the `program` node to lua locals.
This commit is contained in:
Thomas Vigouroux 2020-05-09 12:04:54 +02:00
parent 307c78aa1e
commit d233ec4554
2 changed files with 6 additions and 0 deletions

View file

@ -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

View file

@ -35,6 +35,7 @@
((for_in_statement) @scope)
((repeat_statement) @scope)
((while_statement) @scope)
((program) @scope)
;;; REFERENCES
((identifier) @reference)