Vim icon indicating copy to clipboard operation
Vim copied to clipboard

snippets placeholder transform not working

Open li-yechao opened this issue 8 years ago • 23 comments

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!

li-yechao avatar Oct 30 '18 06:10 li-yechao

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.

idhamhafidz avatar Nov 12 '18 12:11 idhamhafidz

Here too.

redforks avatar Nov 17 '18 00:11 redforks

This bug really drive me nuts.

MeloGuo avatar Nov 30 '18 02:11 MeloGuo

Same here!

trcolgrove avatar Dec 17 '18 23:12 trcolgrove

Same here!

zhuanhao-wu avatar Dec 22 '18 13:12 zhuanhao-wu

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

MrMarc avatar Jan 09 '19 20:01 MrMarc

Me too!

5argon avatar Mar 09 '19 18:03 5argon

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.

prurph avatar Mar 23 '19 23:03 prurph

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 [email protected]:

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 .

5argon avatar Mar 24 '19 00:03 5argon

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?

sloria avatar Jun 09 '19 18:06 sloria

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.

TW80000 avatar Jul 02 '19 20:07 TW80000

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 avatar Aug 16 '19 14:08 lunawarrior

@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.

taybin avatar Oct 17 '19 13:10 taybin

@J-Fields This appears to be fixed on the current master (I can't reproduce the bug based on the first post).

gergelyth avatar Apr 10 '20 08:04 gergelyth

@gergelyth I'm still facing this issue. I have just land on this thread while trying to figure out what is wrong.

m4hi2 avatar Apr 12 '20 08:04 m4hi2

Thanks @gergelyth, this is indeed fixed on master.

J-Fields avatar Apr 13 '20 15:04 J-Fields

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 avatar May 18 '20 14:05 gennaro-tedesco

@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 avatar May 18 '20 15:05 J-Fields

@J-Fields I still see this behavior

OpoOpo avatar Oct 19 '20 09:10 OpoOpo

Issue still seems to be happening, vim enters visual mode and you can't use the snippet properly

MaciekBaron avatar Oct 27 '20 16:10 MaciekBaron