Shortcut Element (IntelliSense Code Snippets)
Specifies the shortcut text used to insert the snippet.
<CodeSnippets>
<CodeSnippet>
<Header>
<Shortcut>
<Shortcut>
Shortcut Text
</Shortcut>
Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
Attributes
None.
Child Elements
None.
Parent Elements
Element |
Description |
---|---|
Contains general information about the code snippet. |
Text Value
A text value is optional.
This text is used as a shortcut for inserting the code snippet. The text value of a Shortcut element can only contain alphanumeric characters, hyphens ( - ), and underscores ( _ ).
Remarks
To use the text value of the Shortcut element to insert a Visual Basic code snippet, type the shortcut value in the Code Editor, and press the TAB key. For example, to insert a code snippet with a Shortcut element value of MySnippet, type MySnippet into the Code Editor and press the TAB key. For more information, see How to: Insert Snippets Into Your Code.
Not
In Visual Basic projects, you can type the first few letters of the shortcut name followed by a question mark (?), and press TAB to see a list of all snippet shortcuts that begin with those letters.
To use the text value of the Shortcut element to insert a Visual C# code snippet, type the shortcut value in the Code Editor, and press the TAB key twice. For example, to insert a code snippet with a Shortcut element value of MySnippet, type MySnippet into the Code Editor and press the TAB key twice. For more information, see How To: Use Code Snippets (C#).
If two code snippets contain the same Shortcut element value, a disambiguator box will open after you type the shortcut and press the TAB key, allowing you to select the correct code snippet.
Example
The Shortcut element in the following example has a value of copyfile. To insert this code snippet, type copyfile in the Code Editor and press the TAB key.
<CodeSnippets xmlns="https://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Copy File</Title>
<Author>Microsoft Corporation</Author>
<Description>Copies a file and saves it as another file.</Description>
<HelpUrl>www.microsoft.com</HelpUrl>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<Keywords>
<Keyword>File copying</Keyword>
<Keyword>Copying files</Keyword>
</Keywords>
<Shortcut>copyfile</Shortcut>
</Header>
<Snippet>
<!-- Insert snippet information here -->
</Snippet>
</CodeSnippet>
</CodeSnippets>
See Also
Tasks
How to: Assign a Shortcut Name to a Snippet