zoukankan      html  css  js  c++  java
  • vs2015添加.snippet文件,实现快速模板生成

    依次找到 工具---->代码片段管理器---->语言选择(自己的开发语言)---->点击导入.snippet文件

    //文件一

    #1.snippet

    <?xml version="1.0" encoding="utf-8"?>
    <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
        <CodeSnippet Format="1.0.0">
            <Header>
                <Title>#1</Title>
                <Shortcut>#1</Shortcut>
                <Description>c语言main函数</Description>
                <Author>Microsoft Corporation</Author>
                <SnippetTypes>
                    <SnippetType>Expansion</SnippetType>
                    <SnippetType>SurroundsWith</SnippetType>
                </SnippetTypes>
            </Header>
            <Snippet>
                <Declarations>
                    <Literal>
                        <ID>expression</ID>
                        <ToolTip>要计算的表达式</ToolTip>
                        <Default>true</Default>
                    </Literal>
                </Declarations>
                <Code Language="cpp"><![CDATA[#define _CRT_SECURE_NO_WARNINGS
    #include<stdio.h>
    #include<string.h>
    #include<stdlib.h>
    #include<math.h>
    #include<time.h>
    
    int main()
    {
    
        $selected$$end$
    
        system("pause");
        return EXIT_SUCCESS;
    }
                        ]]>
                </Code>
            </Snippet>
        </CodeSnippet>
    </CodeSnippets>

    //文件二

    #2.snippet

    <?xml version="1.0" encoding="utf-8"?>
    <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
        <CodeSnippet Format="1.0.0">
            <Header>
                <Title>#2</Title>
                <Shortcut>#2</Shortcut>
                <Description>c++语言main函数</Description>
                <Author>Microsoft Corporation</Author>
                <SnippetTypes>
                    <SnippetType>Expansion</SnippetType>
                    <SnippetType>SurroundsWith</SnippetType>
                </SnippetTypes>
            </Header>
            <Snippet>
                <Declarations>
                    <Literal>
                        <ID>expression</ID>
                        <ToolTip>要计算的表达式</ToolTip>
                        <Default>true</Default>
                    </Literal>
                </Declarations>
                <Code Language="cpp"><![CDATA[#define _CRT_SECURE_NO_WARNINGS
    #include<iostream>
    using namespace std;
    
    int main()
    {
        
        $selected$$end$
    
        system("pause");
        return EXIT_SUCCESS;
    }]]>
                </Code>
            </Snippet>
        </CodeSnippet>
    </CodeSnippets>
  • 相关阅读:
    返回一个整数数组中最大子数组的和
    对autocad的建议
    作业:30道四则运算——C++编程
    四则运算2
    [leetcode] Letter Combinations of a Phone Number
    [leetcode] Pow(x, n)
    [leetcode] Longest Common Prefix
    [leetcode] Binary Tree Zigzag Level Order Traversal
    [leetcode] Construct Binary Tree from Preorder and Inorder Traversal
    [leetcode] Construct Binary Tree from Inorder and Postorder Traversal
  • 原文地址:https://www.cnblogs.com/baconZhang/p/13715255.html
Copyright © 2011-2022 走看看