fix: use vim.treesitter.query instead of deprecated nvim-treesitter.ts_utils (#919)

This commit is contained in:
Łukasz Kurpiewski
2022-04-19 12:43:36 +02:00
committed by GitHub
parent 2aa7eee28b
commit 07132dc597

View File

@@ -175,7 +175,6 @@ compare.scopes = setmetatable({
if ok then if ok then
local win, buf = vim.api.nvim_get_current_win(), vim.api.nvim_get_current_buf() local win, buf = vim.api.nvim_get_current_win(), vim.api.nvim_get_current_buf()
local cursor_row = vim.api.nvim_win_get_cursor(win)[1] - 1 local cursor_row = vim.api.nvim_win_get_cursor(win)[1] - 1
local ts_utils = require('nvim-treesitter.ts_utils')
-- Cursor scope. -- Cursor scope.
local cursor_scope = nil local cursor_scope = nil
@@ -205,7 +204,7 @@ compare.scopes = setmetatable({
for _, definition in pairs(definitions) do for _, definition in pairs(definitions) do
if s <= definition.node:start() and definition.node:end_() <= e then if s <= definition.node:start() and definition.node:end_() <= e then
if scope:id() == locals.containing_scope(definition.node, buf):id() then if scope:id() == locals.containing_scope(definition.node, buf):id() then
local text = ts_utils.get_node_text(definition.node)[1] local text = vim.treesitter.query.get_node_text(definition.node)[1]
if not self.scopes_map[text] then if not self.scopes_map[text] then
self.scopes_map[text] = depth self.scopes_map[text] = depth
end end