add winnr to get_node_at_cursor

This commit is contained in:
kiyan42 2020-06-19 14:13:23 +02:00
parent cabe61ac19
commit cf72524b2f
3 changed files with 5 additions and 4 deletions

View file

@ -206,8 +206,8 @@ function M.previous_scope(node)
end
end
function M.get_node_at_cursor()
local cursor = api.nvim_win_get_cursor(0)
function M.get_node_at_cursor(winnr)
local cursor = api.nvim_win_get_cursor(winnr or 0)
local root = parsers.get_parser().tree:root()
return root:named_descendant_for_range(cursor[1]-1,cursor[2],cursor[1]-1,cursor[2])
end