Describe the bug
snippets placeholder transform not working
To Reproduce
"HelloWorld": {
"prefix": "test",
"body": "${1} ${2} -> ${1/Hello/Hallo/} ${2/World/Welt/}"
}
type
Hello World -> Hello World
Expected behavior
Hello World -> Hallo Welt
it's work after disable vim plugin!
I have the same problem. After uninstall this extension, the snippets seems to be working again.
To reproduce, create multiple same variable in snippets like console.log(${variable1}, ${variable1}).
Whenever you want to enter something at the variable, it will fail.
Here too.
This bug really drive me nuts.
Same here!
Same here!
man - I wish that I'd found that other people were having this same problem before I racked my brain trying to figure out what I was doing wrong.
i.e. me too
Me too!
Also struggling with this. As a workaround you can use the left then right arrow keys to sync the cursors, then use backspace to delete the placeholder, then type your desired text.
Hi, I am already using that workaround for cursor sync problem. This
problem however is placeholder transform. (the content change one last
time when you press enter)
I have not found any workaround to make it work other than turning off vim
on using the snippet
2019年3月24日(日) 6:35 Prescott Murphy notifications@github.com:
Also struggling with this. As a workaround you can use the left then right
arrow keys to sync the cursors, then use backspace to delete the
placeholder, then type your desired text.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/VSCodeVim/Vim/issues/3176#issuecomment-475914000, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AFZDHNBBLd66ysYl9e33HoQvkwrQ_XrUks5vZrovgaJpZM4YBPh5
.
This is quite an annoyance.
I have not found any workaround to make it work other than turning off vim on using the snippet
@5argon Is there a way to do this automatically? Or do you manually toggle off vim mode before entering every snippet?
Can't speak to how features compare, but this plugin is the second most installed Vim plugin for VS Code at the time of writing and it doesn't have this issue.
I found a workaround that makes it much less annoying: In the keybindings for the command "extension.vim_backspace" add to the When clause "!editorHasSelection".
This allows you to press backspace and delete the things that are automatically highlighted during the snippet process.
The only downside is if you had anything hooked up to backspace in Visual Mode it will no longer work.
@lunawarrior This works, but I found that it enables deleting with the backspace when in Visual Mode, which feels weird. I tried adding some more toggles to the When clause, but couldn't find a combination that would keep the previous behavior.
@J-Fields This appears to be fixed on the current master (I can't reproduce the bug based on the first post).
@gergelyth I'm still facing this issue. I have just land on this thread while trying to figure out what is wrong.
Thanks @gergelyth, this is indeed fixed on master.
Has this been released in the plug-in? I am still seeing the same old behaviour (namely the snippets not working as described in all comments above).
@gennaro-tedesco Yes, this should be fixed in the released version. Please file a new issue with repro steps if you've still got a problem with snippets.
@J-Fields I still see this behavior
Issue still seems to be happening, vim enters visual mode and you can't use the snippet properly
Still got the same issue here as well.
I found a workaround that makes it much less annoying: In the keybindings for the command "extension.vim_backspace" add to the When clause "!editorHasSelection".
This allows you to press backspace and delete the things that are automatically highlighted during the snippet process.
The only downside is if you had anything hooked up to backspace in Visual Mode it will no longer work.
How did you do that?
I'd suggest instead of messing around with the underlying keybinding, just add this to your vimrc:
vnoremap <BS> c
@J-Fields
I got the same issue too.
The first workaround I tried is to use the key "c" to delete the selected words in visual mode and changed to insert mode.
However, sometimes click "c" for one time can work. Sometimes, need to click two times. I don't understand this...
So I thought out another solution: define a shortcut for "esc", "c", "i", "w", this will change to normal mode then delete the placeholder and change to insert mode.
Most helpful comment
I found a workaround that makes it much less annoying: In the keybindings for the command "extension.vim_backspace" add to the When clause "!editorHasSelection".
This allows you to press backspace and delete the things that are automatically highlighted during the snippet process.
The only downside is if you had anything hooked up to backspace in Visual Mode it will no longer work.