Bug in Ultisnips ? Using 'complex' nested snippets and jumping to placeholders
bew opened this issue · comments
Benoit de Chezelles commented
Given these snippets (for ultisnips files)
snippet vis "VISUAL placeholder with default value" w
\$\{VISUAL${1:${2:default}${3:/${4:transform}/}}\}
endsnippet
snippet n "Numeric placeholder with default value" w
${$1:$2}
endsnippet
(TODO: try to reduce snippets code to minimal that still reproduce the bug)
Given:
<tab>
is the snippet expansion binding<next>
selects the next placeholder[abc]
meansabc
is the selected text (in select mode)ab[]c
the cursor is betweenb
andc
(in insert mode)
Doing the following actions:
n<tab>1<next>vis<tab><backspace><next><next><next>
Here is what I see at each step:
- do:
n<tab>
out:${[]:}
(in snippet n) - do:
1<next>
out:${1:[]}
(in snippet n) - do:
vis<tab>
out:${1:${VISUAL[default/transform/]}}
(in snippet vis) - do:
<backspace><next>
out:${1:${VISUAL}[]}
(in snippet vis ? or snippet n ?) - do:
<next>
(I want to get out now!)
out:${1:[${VISUAL}]}
(:warning: this is unexpected... Still in snippet n ?) - do:
<next>
(I guess I'm still in snippet n, I want to get out now!)
out:${1:j}
(note:Alt-j
(<M-j>
) is my<next>
snippet; and now I'm not in a snippet anymore as subsequentAlt-j
goes to the next line like a<esc>j
would do when not in a snippet)
This would mean I was not in a snippet when doing that last<next>
? How do I get out then ?
I wanted: ${1:${VISUAL}}[]
([]
is the cursor in insert mode)
Benoit de Chezelles commented
I should migrate to LuaSnip instead! (neovim 0.5 !!)