mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
fix(snippet): adjacent tabstops without placeholders (#35167)
* fix(snippet): adjacent tabstops without placeholders * test(snippet): add tests for directly adjacent tabstops
This commit is contained in:
@@ -163,6 +163,48 @@ describe('vim.snippet', function()
|
||||
eq({ 'class Foo() {', ' // Inside', '}' }, buf_lines(0))
|
||||
end)
|
||||
|
||||
it('handles directly adjacent tabstops (ascending order)', function()
|
||||
test_expand_success({ '${1:one}${2:-two}${3:-three}' }, { 'one-two-three' })
|
||||
feed('1')
|
||||
feed('<Tab>')
|
||||
poke_eventloop()
|
||||
feed('2')
|
||||
feed('<Tab>')
|
||||
poke_eventloop()
|
||||
feed('3')
|
||||
feed('<Tab>')
|
||||
poke_eventloop()
|
||||
eq({ '123' }, buf_lines(0))
|
||||
end)
|
||||
|
||||
it('handles directly adjacent tabstops (descending order)', function()
|
||||
test_expand_success({ '${3:three}${2:-two}${1:-one}' }, { 'three-two-one' })
|
||||
feed('1')
|
||||
feed('<Tab>')
|
||||
poke_eventloop()
|
||||
feed('2')
|
||||
feed('<Tab>')
|
||||
poke_eventloop()
|
||||
feed('3')
|
||||
feed('<Tab>')
|
||||
poke_eventloop()
|
||||
eq({ '321' }, buf_lines(0))
|
||||
end)
|
||||
|
||||
it('handles directly adjacent tabstops (mixed order)', function()
|
||||
test_expand_success({ '${3:three}${1:-one}${2:-two}' }, { 'three-one-two' })
|
||||
feed('1')
|
||||
feed('<Tab>')
|
||||
poke_eventloop()
|
||||
feed('2')
|
||||
feed('<Tab>')
|
||||
poke_eventloop()
|
||||
feed('3')
|
||||
feed('<Tab>')
|
||||
poke_eventloop()
|
||||
eq({ '312' }, buf_lines(0))
|
||||
end)
|
||||
|
||||
it('handles multiline placeholders', function()
|
||||
test_expand_success(
|
||||
{ 'public void foo() {', ' ${0:// TODO Auto-generated', ' throw;}', '}' },
|
||||
|
Reference in New Issue
Block a user