mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
fix(snippet): jumping backwards to choice node (#35062)
Avoid duplicate text when jumping back to a choice node. Set cursor to
end of tabstop range and prioritize current choice in completion items.
(cherry picked from commit 628d569a59
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
2e4baa3679
commit
41fa343484
@@ -240,6 +240,23 @@ describe('vim.snippet', function()
|
||||
eq({ 'public function foo() {', '\t', '}' }, buf_lines(0))
|
||||
end)
|
||||
|
||||
it('does not change the chosen text when jumping back to a choice tabstop', function()
|
||||
test_expand_success(
|
||||
{ '${1|public,protected,private|} function ${2:name}() {', '\t$0', '}' },
|
||||
{ ' function name() {', '\t', '}' }
|
||||
)
|
||||
wait_for_pum()
|
||||
feed('<C-n><C-y><Tab>')
|
||||
poke_eventloop()
|
||||
feed('<S-Tab>')
|
||||
poke_eventloop()
|
||||
wait_for_pum()
|
||||
feed('<Tab>')
|
||||
poke_eventloop()
|
||||
feed('foo')
|
||||
eq({ 'protected function foo() {', '\t', '}' }, buf_lines(0))
|
||||
end)
|
||||
|
||||
it('jumps through adjacent tabstops', function()
|
||||
test_expand_success(
|
||||
{ 'for i=1,${1:to}${2:,step} do\n\t$3\nend' },
|
||||
|
Reference in New Issue
Block a user