microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.18k stars 28.84k forks source link

Shortcut for Selecting Placeholder Text in Snippets #213900

Closed VKrishna04 closed 1 month ago

VKrishna04 commented 4 months ago

Description:

In Visual Studio Code, when a snippet is inserted, it often contains placeholders that are highlighted in a gray box. Currently, we can navigate through these placeholders using the Tab key and Shift + Tab keys, but there isn't a shortcut to select the content of these placeholders.

Feature Request:

I propose a new shortcut that allows users to quickly select the content of these placeholders. This would improve the efficiency of using snippets, as users could quickly replace the placeholder content without having to manually select it.

Steps to Reproduce:

  1. Insert a snippet that contains placeholders.
  2. Try to select the content of the placeholder using a shortcut.

Expected Result:

There should be a shortcut that selects the content of the placeholder.

Actual Result:

Currently, there is no such shortcut.

Additional Information:

This feature would be particularly useful for snippets that contain multiple placeholders. It would allow users to quickly replace all placeholder content without having to manually select each one.

Please consider adding this feature. Thank you for your time and consideration.

jrieken commented 4 months ago

There should be a shortcut that selects the content of the placeholder.

Snippets already do that. You can declare a placeholder like so ${1:willBeSelected} and when navigating to that place the text will be selected. Is this what you mean?

RedCMD commented 4 months ago

https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax

vs-code-engineering[bot] commented 1 month ago

Hey @jrieken, this issue might need further attention.

@VKrishna04, you can help us out by closing this issue if the problem no longer exists, or adding more information.

VKrishna04 commented 1 month ago

yup i got it after using snippets we simply start typing and then for next part we click on tab