@@ -14,7 +14,7 @@ local shell = {
14
14
right_var = ' }"' ,
15
15
find_treesitter_variable = function (opts )
16
16
if opts .node :type () == " variable_name" then
17
- return opts .node_text
17
+ return opts .get_node_text ( opts . node )
18
18
else
19
19
return nil
20
20
end
@@ -36,11 +36,10 @@ local js = {
36
36
mid_var = ' ", ' ,
37
37
right_var = " )" ,
38
38
find_treesitter_variable = function (opts )
39
- if
40
- opts .node :type () == " identifier"
41
- or opts .node :type () == " shorthand_property_identifier_pattern"
42
- then
43
- return opts .node_text
39
+ if opts .node :type () == " property_identifier" then
40
+ return opts .get_node_text (opts .node :parent ())
41
+ elseif opts .node :type () == " identifier" then
42
+ return opts .get_node_text (opts .node )
44
43
else
45
44
return nil
46
45
end
@@ -151,8 +150,16 @@ return {
151
150
mid_var = " ' .. vim.inspect(" ,
152
151
right_var = " ))" ,
153
152
find_treesitter_variable = function (opts )
154
- if opts .node :type () == " identifier" then
155
- return opts .node_text
153
+ if opts .node :type () == " dot_index_expression" then
154
+ return opts .get_node_text (opts .node )
155
+ elseif
156
+ opts .node :parent ()
157
+ and opts .node :parent ():type () == " dot_index_expression"
158
+ and opts .node :prev_named_sibling ()
159
+ then
160
+ return opts .get_node_text (opts .node :parent ())
161
+ elseif opts .node :type () == " identifier" then
162
+ return opts .get_node_text (opts .node )
156
163
else
157
164
return nil
158
165
end
0 commit comments