File tree 2 files changed +24
-5
lines changed
2 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,12 @@ M.find_treesitter_variable = function()
21
21
local node_type = node :type ()
22
22
local variable_name = vim .treesitter .query .get_node_text (node , 0 )
23
23
24
- if node_type ~= " identifier" then
25
- return nil
26
- else
24
+ -- lua -> identifier
25
+ -- sh -> variable_name
26
+ if node_type == " identifier " or node_type == " variable_name " then
27
27
return variable_name
28
+ else
29
+ return nil
28
30
end
29
31
end
30
32
end
Original file line number Diff line number Diff line change @@ -635,7 +635,7 @@ describe("can handle treesitter identifiers", function()
635
635
" end" ,
636
636
}, " lua" , 2 , 10 )
637
637
638
- feedkeys (" g?v<CR> " )
638
+ feedkeys (" g?v" )
639
639
640
640
check_lines ({
641
641
" function x()" ,
@@ -646,7 +646,24 @@ describe("can handle treesitter identifiers", function()
646
646
" end" ,
647
647
})
648
648
649
- assert .are .same (vim .api .nvim_win_get_cursor (0 ), { 3 , 4 })
649
+ assert .are .same (vim .api .nvim_win_get_cursor (0 ), { 2 , 10 })
650
+ end )
651
+
652
+ it (" standard (bash)" , function ()
653
+ debugprint .setup ({})
654
+
655
+ local filename = init_file ({
656
+ " XYZ=123" ,
657
+ }, " sh" , 1 , 1 )
658
+
659
+ feedkeys (" g?v" )
660
+
661
+ check_lines ({
662
+ " XYZ=123" ,
663
+ ' echo "DEBUGPRINT[1]: ' .. filename .. ' :1: XYZ=${XYZ}"' ,
664
+ })
665
+
666
+ assert .are .same (vim .api .nvim_win_get_cursor (0 ), { 1 , 1 })
650
667
end )
651
668
652
669
it (" non-identifier" , function ()
You can’t perform that action at this time.
0 commit comments