From 945e01e39fc137bd74bb3aa8c4f40e6ffb5be2dd Mon Sep 17 00:00:00 2001 From: oncomouse Date: Sun, 12 Feb 2023 10:18:03 -0600 Subject: [PATCH] update nvim 0.7 treesitter api (#272) --- lua/treesitter-matchup/internal.lua | 2 +- lua/treesitter-matchup/third-party/hl-info.lua | 2 +- lua/treesitter-matchup/third-party/utils.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/treesitter-matchup/internal.lua b/lua/treesitter-matchup/internal.lua index 8f933b1..00594ea 100644 --- a/lua/treesitter-matchup/internal.lua +++ b/lua/treesitter-matchup/internal.lua @@ -204,7 +204,7 @@ function M.get_delim(bufnr, opts) for _, side in ipairs(side_table[opts.side]) do if not(side == 'mid' and vim.g.matchup_delim_nomids > 0) then for _, node in ipairs(active_nodes[side]) do - if ts_utils.is_in_node_range(node, cursor[1]-1, cursor[2]) then + if vim.treesitter.is_in_node_range(node, cursor[1]-1, cursor[2]) then local len = ts_utils.node_length(node) if len < smallest_len then smallest_len = len diff --git a/lua/treesitter-matchup/third-party/hl-info.lua b/lua/treesitter-matchup/third-party/hl-info.lua index b5dd063..0b34b75 100644 --- a/lua/treesitter-matchup/third-party/hl-info.lua +++ b/lua/treesitter-matchup/third-party/hl-info.lua @@ -46,7 +46,7 @@ if vim.treesitter.highlighter.hl_map and vim.fn.has('nvim-0.9.0') == 0 then local iter = query:query():iter_captures(root, self.bufnr, row, row + 1) for capture, node, _ in iter do - if ts_utils.is_in_node_range(node, row, col) then + if vim.treesitter.is_in_node_range(node, row, col) then local c = query._query.captures[capture] -- name of the capture in the query if c ~= nil then local general_hl, is_vim_hl = query:_get_hl_from_capture(capture) diff --git a/lua/treesitter-matchup/third-party/utils.lua b/lua/treesitter-matchup/third-party/utils.lua index 74e44f6..19a4390 100644 --- a/lua/treesitter-matchup/third-party/utils.lua +++ b/lua/treesitter-matchup/third-party/utils.lua @@ -67,7 +67,7 @@ function M.get_hl_groups_at_position(bufnr, row, col) for capture, node, metadata in iter do local hl = query.hl_cache[capture] - if hl and ts_utils.is_in_node_range(node, row, col) then + if hl and vim.treesitter.is_in_node_range(node, row, col) then local c = query._query.captures[capture] -- name of the capture in the query if c ~= nil then table.insert(matches, { capture = c, priority = metadata.priority })