You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Adopt insert&replace range for snippet completions #83834
For #10266 we are adding insert and replace ranges to completion items. Provider that currently provide a range only need to be adopted and snippets is one of them.
To verify: have a snippet with prefix "foo" and insert it at '|foo', 'f|oo', and 'foo|'. Insert via tab and shift+tab to toggle between insert and replace mode
Activity
Adopt insert & replace in snippet provider.
TylerLeonhardt commentedon Nov 19, 2019
Nice! How do I use this? Since snippets are static I'm curious how I specify the range in the json file
jrieken commentedon Nov 19, 2019
The snippet prefix decides:
vscode/src/vs/workbench/contrib/snippets/test/browser/snippetsService.test.ts
Line 424 in 8e91d73
TylerLeonhardt commentedon Nov 19, 2019
So if the prefix is exactly the same as the start of the snippet, it will do a replace? Am I interpreting that correctly?
And if they're not exact, no replace happens?
jrieken commentedon Nov 20, 2019
yes
jrieken commentedon Dec 3, 2019
To verify: have a snippet with prefix "foo" and insert it at '|foo', 'f|oo', and 'foo|'. Insert via tab and shift+tab to toggle between insert and replace mode
rebornix commentedon Dec 4, 2019
Tested all three cases for
foo,f|ooandfoo|work as expected but|foodoesn't.Snippet
foofoosnippet in suggest widgetTylerLeonhardt commentedon Dec 4, 2019
This is working! (minus the scenario Peng Lyu (@rebornix) mentioned) I'll update our snippets to have a prefix that lines up with the body. Thanks!
jrieken commentedon Dec 5, 2019
I have extracted #86386