Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

Shortcut Element (IntelliSense Code Snippets)

Specifies the shortcut text used to insert the snippet.

<CodeSnippets>
   <CodeSnippet>
     <Header>
       <Shortcut>
<Shortcut>
    Shortcut Text
</Shortcut>

The following sections describe attributes, child elements, and parent elements.

Attributes

None.

Child Elements

None.

Parent Elements

Element

Description

Header

Contains general information about the code snippet.

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 ( _ ).

Caution noteCaution

_ and – are not supported characters in C++ snippet shortcuts.

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.

NoteNote

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.

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.

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="http://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>
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.