New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve Current Selection when using snippet with TM_SELECTED_TEXT variable #62907
Comments
You can achieve this via
Just to clarify - that is typing "over" a selection with a snippet prefix, then selecting that snippet will resolve the TM_SELECTION variable to the typed-over word? Can you attach a gif from another editing doing this? |
As I stated, this is going through another palette. E.g. in Sublime Text snippets directly register in the Command Palette (Ctrl+shift+P or F1 in this case). Going in the Insert Snippet submenu each time is tedious.
You do not even have to leave VS Code to demonstrate. Just mark a word or sentence and type ". |
Makes sense. |
Adding this feature would be very nice. |
To verify:
|
Currently snippets with prefixes set become rather useless when they contain the selected text variable.
I have a snippet like this:
What I want is being able to select text, start typing lin (which will of course remove the selection) and then IntelliSense will recommend lin as a completion. When I press enter I want the selection to reappear, surrounded by my snippet.
This behavior is actually standard in other editors and I was kind of surprised to find no useful way to use snippets with a completion prefix when the selction variable is being used.
If this is unwanted by some users this should be made configurable as an option, but as a hardware developer I find myself in the situation quite often where this would be useful, as such 'surrounding pragmas' are pretty common.
Another variant would be to make snippets able to be promoted to commands for the Ctrl+Shift+P command palette, so we don't have to go into the insert snippet sub palette. I do not want to assign dedicated Key Bindings, as it just becomes to much. The prefix 'is the keybinding'.
The text was updated successfully, but these errors were encountered: