mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-04 04:20:09 -04:00
fix(ts_utils): be sure to parse to get root
Be sure to call `parser:parser()` to get a tree instead of getting the tree directly. This will not cost anything is the buffer is freshly parsed. Fixes #181
This commit is contained in:
parent
a382e28c95
commit
1849f30bb5
1 changed files with 1 additions and 1 deletions
|
|
@ -210,7 +210,7 @@ end
|
|||
|
||||
function M.get_node_at_cursor(winnr)
|
||||
local cursor = api.nvim_win_get_cursor(winnr or 0)
|
||||
local root = parsers.get_parser().tree:root()
|
||||
local root = parsers.get_parser():parse():root()
|
||||
return root:named_descendant_for_range(cursor[1]-1,cursor[2],cursor[1]-1,cursor[2])
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue