Visual Studio code snippets Cursor

前端 未结 1 1654
情歌与酒
情歌与酒 2021-02-02 05:40

In Visual Studio when you insert a snippet and finish inserting literals the cursor jumps to the beginning of the snippet.

Now I\'d like to tell visual studio where the

相关标签:
1条回答
  • 2021-02-02 06:04

    Use the $end$ variable as shown in the following "if" snippet for c#.

    <?xml version="1.0" encoding="utf-8" ?>
    <CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
        <CodeSnippet Format="1.0.0">
            <Header>
                <Title>if</Title>
                <Shortcut>if</Shortcut>
                <Description>Code snippet for if statement</Description>
                <Author>Microsoft Corporation</Author>
                <SnippetTypes>
                    <SnippetType>Expansion</SnippetType>
                    <SnippetType>SurroundsWith</SnippetType>
                </SnippetTypes>
            </Header>
            <Snippet>
                <Declarations>
                    <Literal>
                        <ID>expression</ID>
                        <ToolTip>Expression to evaluate</ToolTip>
                        <Default>true</Default>
                    </Literal>
                </Declarations>
                <Code Language="csharp"><![CDATA[if ($expression$)
        {
            $selected$ $end$
        }]]>
                </Code>
            </Snippet>
        </CodeSnippet>
    </CodeSnippets>
    
    0 讨论(0)
提交回复
热议问题