Search code examples
visual-studiotabscode-snippets

Visual Studio: How to insert tab instead of code snippet


Whenever I hit the key after a keyword that comes from the list of code snippets, Visual Studio always inserts the code snippet.

However, this is very disturbing when I want to add one-line comments to existing code. I can't, for example, add a TAB character after the else keyword.

What keyboard combination do I have to press in order to get a TAB character inserted here?

Your help is appreciated.


Solution

  • A simple workaround for your else scenario is to insert a space and then the tab character, then remove the space.

    If you want to make changes to snippets, you can do this by going to Tools -> Code Snippets Manager (Ctrl-K, Ctrl-B) and select the snippet you wish to modify. The path to the .snippet file will be shown. You can just open the file in a text editor and modify it to do the action you want.