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:
Thomas Vigouroux 2020-07-15 09:29:12 +02:00 committed by Thomas Vigouroux
parent a382e28c95
commit 1849f30bb5

View file

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