How to: Assign a Shortcut Name to a Snippet
Shortcut names provide a way for you to insert IntelliSense Code Snippets into your code by typing a shortcut name and then pressing Tab. The shortcut name for an IntelliSense Code Snippet is changed by modifying the XML .snippet file.
To change the shortcut name for a snippet
Locate the .snippet file for the snippet that you want to edit. The snippets that appear in the picker are stored as files in subfolders of specific file locations. The file locations can be examined and changed using the Code Snippets Manager.
On the File menu, click Open and then click File.
Click the file you want to open, and then click Open.
In the editor, locate the Header element of the code snippet.
Add a Shortcut element as a child of the Header element. Make the text value of the Shortcut element the shortcut name. For example, if the following code were part of a Visual Basic code snippet XML file, you would type "MyShortcut" and press Tab to insert the code snippet.
Note
You must press Tab twice to insert Visual C# and Visual J# code snippets.
<Shortcut>MyShortcut</Shortcut>
Note
The text value of a Shortcut element can only contain alphanumeric characters, hyphens ( - ), and underscores ( _ ).
Save the file.
See Also
Tasks
How to: Create a Basic Code Snippet
Concepts
How to: Insert IntelliSense Code Snippets
Visual Basic IntelliSense Code Snippets
Code Snippets Schema Reference
Reference
Shortcut Element (IntelliSense Code Snippets)