File tree 2 files changed +5
-3
lines changed
lua/nvim-treesitter-refactor
2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ local ts_utils = require "nvim-treesitter.ts_utils"
4
4
local utils = require " nvim-treesitter.utils"
5
5
local locals = require " nvim-treesitter.locals"
6
6
local configs = require " nvim-treesitter.configs"
7
+ local ts_query = vim .treesitter .query
7
8
local api = vim .api
8
9
9
10
local M = {}
@@ -70,7 +71,7 @@ function M.list_definitions(bufnr)
70
71
for _ , node in ipairs (definitions ) do
71
72
local lnum , col , _ = node .node :start ()
72
73
local type = string.upper (node .type :sub (1 , 1 ))
73
- local text = ts_utils .get_node_text (node .node )[ 1 ] or " "
74
+ local text = ts_query .get_node_text (node .node , bufnr ) or " "
74
75
table.insert (qf_list , {
75
76
bufnr = bufnr ,
76
77
lnum = lnum + 1 ,
@@ -125,7 +126,7 @@ function M.list_definitions_toc()
125
126
126
127
local lnum , col , _ = def .node :start ()
127
128
local type = string.upper (def .type :sub (1 , 1 ))
128
- local text = ts_utils .get_node_text (def .node )[ 1 ] or " "
129
+ local text = ts_query .get_node_text (def .node , bufnr ) or " "
129
130
table.insert (loc_list , {
130
131
bufnr = bufnr ,
131
132
lnum = lnum + 1 ,
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ local ts_utils = require "nvim-treesitter.ts_utils"
5
5
local locals = require " nvim-treesitter.locals"
6
6
local configs = require " nvim-treesitter.configs"
7
7
local utils = require " nvim-treesitter.utils"
8
+ local ts_query = vim .treesitter .query
8
9
local api = vim .api
9
10
10
11
local M = {}
@@ -42,7 +43,7 @@ function M.smart_rename(bufnr)
42
43
return
43
44
end
44
45
45
- local node_text = ts_utils .get_node_text (node_at_point )[ 1 ]
46
+ local node_text = ts_query .get_node_text (node_at_point , bufnr )
46
47
local input = { prompt = " New name: " , default = node_text or " " }
47
48
if not vim .ui .input then
48
49
local new_name = vim .fn .input (input .prompt , input .default )
You can’t perform that action at this time.
0 commit comments