File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
1
local M = {}
2
2
3
3
local ts = vim .treesitter
4
- local get_node_text = vim .treesitter .get_node_text or vim .treesitter .query .get_node_text
5
- local ts_utils = require (" nvim-treesitter.ts_utils" )
6
- local parsers = require (" nvim-treesitter.parsers" )
7
4
8
5
local make_default_opts = function ()
9
6
return {
@@ -182,8 +179,11 @@ local is_container = function(filetype, node)
182
179
end
183
180
184
181
local get_container_at_cursor = function (filetype )
185
- parsers .get_parser (0 ):parse ()
186
- local node = ts_utils .get_node_at_cursor ()
182
+ ts .get_parser ():parse ()
183
+ local node = ts .get_node ()
184
+ if node == nil then
185
+ return
186
+ end
187
187
while not is_container (filetype , node ) do
188
188
node = node :parent ()
189
189
if node == nil then
@@ -253,7 +253,7 @@ M.format_at_cursor = function()
253
253
table.insert (children , { node = child , name = name })
254
254
end
255
255
for i , child in ipairs (children ) do
256
- local lines = vim .split (get_node_text (child .node , 0 ), " \n " )
256
+ local lines = vim .split (ts . get_node_text (child .node , 0 ), " \n " )
257
257
if
258
258
opts .final_separator
259
259
and i > 1
You can’t perform that action at this time.
0 commit comments