visual studio snippet备忘

Posted 松山居士的家

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了visual studio snippet备忘相关的知识,希望对你有一定的参考价值。

一、C++

classheadercpp.snippet

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>类注释</Title>
            <Shortcut>===</Shortcut>
            <Description>类头文件注释</Description>
            <Author>airscrat</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
            </Declarations>
            <Code Language="cpp">
                <![CDATA[/********************************************************
[Author  ]:Mr.Huang
[Email   ]:airscrat(at)qq(dot)com
[Content ]:$end$
/********************************************************/]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

functionheadercpp.snippet

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>函数注释</Title>
            <Shortcut>---</Shortcut>
            <Description>函数注释</Description>
            <Author>airscrat</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>name</ID>
                    <ToolTip>函数简介</ToolTip>
                    <Default>类成员</Default>
                </Literal>
            </Declarations>
            <Code Language="cpp">
                <![CDATA[
                #pragma region $name$$end$
                /**
                [Contents]:
                */
                $selected$
                //***************/
                #pragma endregion]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

二、C#

classheadercs.snippet

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>类注释</Title>
            <Shortcut>===</Shortcut>
            <Description>类头文件注释</Description>
            <Author>airscrat</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
            </Declarations>
            <Code Language="csharp">
                <![CDATA[/********************************************************
[Author  ]:Mr.Huang
[Email   ]:airscrat(at)qq(dot)com
[Content ]:$end$
/********************************************************/]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

functionheadercs.snippet

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>函数注释</Title>
            <Shortcut>---</Shortcut>
            <Description>函数注释</Description>
            <Author>airscrat</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>name</ID>
                    <ToolTip>函数简介</ToolTip>
                    <Default>类成员</Default>
                </Literal>
            </Declarations>
            <Code Language="csharp">
                <![CDATA[
                #region $name$$end$
                /// <summary>
                /// $name$
                /// </summary>
                /****************/
                $selected$
                //***************/
                #endregion]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

 

以上是关于visual studio snippet备忘的主要内容,如果未能解决你的问题,请参考以下文章

json Visual Studio代码的PowerShell代码段文件 - 放在〜\AppData \Roaming\Code \User \Snippets目录中

Prism Snippets在使用ReSharper的Visual Studio 2017中无效

Visual Studio 2005 Code Snippets

Visual Studio 2012-2019的130多个jQuery代码片段。

Visual Studio Code配置Markdown文档的snippet不生效的解决

Visual Studio常用小技巧一:代码段+快捷键+插件=效率