diff --git a/lua/nvim-treesitter-textobjects/shared.lua b/lua/nvim-treesitter-textobjects/shared.lua index 7ed3f191..3e438277 100644 --- a/lua/nvim-treesitter-textobjects/shared.lua +++ b/lua/nvim-treesitter-textobjects/shared.lua @@ -159,8 +159,8 @@ local function get_capture_ranges_recursively(bufnr, query_string, query_group) for _, match in pairs(matches) do local found = get_at_path(match, query_string) if found then - ---@cast found Range6 - table.insert(ranges, found) + ---@cast found TSNode + table.insert(ranges, { found:range(true) }) end end end) @@ -194,7 +194,9 @@ function M.find_best_range(bufnr, capture_string, query_group, filter_predicate, local matches = get_query_matches(bufnr, query_group, root, lang) for _, maybe_match in pairs(matches) do - local range = get_at_path(maybe_match, capture_string) + local node = get_at_path(maybe_match, capture_string) + ---@cast node TSNode + local range = { node:range(true) } ---@cast range Range6 if range and filter_predicate(range) then