zoukankan      html  css  js  c++  java
  • Vscode:代码片段

     

    用户代码片段是Vscode中用户设置中的可自定义的部分,可以自己定义头文件和函数注释等等所有拟想要的东西:

    • 头文件
    • 函数注释
    • 常用代码模块

    在vscode中进入【用户代码片段】设置:

    在弹出的命令框中选择python.json,打开后就会进入到python.json的编辑模式,看到下面这段代码:

    Place your snippets for python here. Each snippet is defined under a snippet name and has a prefix, body and description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
    $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the same ids are connected.

    那么就可以直接在下面编辑代码片段:

    {
        // Place your snippets for python here. Each snippet is defined under a snippet name and has a prefix, body and 
        // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
        // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
        // same ids are connected.
        // Example:
        "HEADER": {
            "prefix": "header",
            "body": [
                "#!/usr/bin/env python",
                "# -*- encoding: utf-8 -*-",
                "'''",
                "@NAME      :$TM_FILENAME",
                "@TIME      :$CURRENT_YEAR/$CURRENT_MONTH/$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
                "@AUTHOR     :watalo",
                "@VERSION   :0.0.x",
                "'''",
                "",
                "class CCC:",
                "   def __init__(self):",
                "       pass",
                "",
                "def Func():",
                "   pass",
                "",
                "",
                "if __name__ == '__main__':"
                "$0"
            ],
    ​
         },
        "FUNCTION":{
            "prefix": "def",
            "body":[
                "def func(var):",
                "   '''",
                "   @description:",
                "   @param {var}:",
                "   @return:",
                "   '''",
                "   pass",
                "$0",
            ]
        }
    }

     

  • 相关阅读:
    CF-1328 F. Make k Equal
    CF-1328 E. Tree Queries
    USACO_1.1_Greedy_Gift_Givers_(模拟+水题)
    USACO_1.1_Your_Ride_Is_Here_(字符串+水题)
    第3章 文件系统
    BZOJ_1629_[Usaco2007_Demo]_Cow_Acrobats_(贪心)
    BZOJ_1628_[Usaco2007_Demo]_City_skyline_(单调栈)
    BZOJ_1030_[JSOI2007]_文本生成器_(AC自动机+DP)
    BZOJ_1029_[JSOI2007]_建筑抢修_(贪心+优先队列)
    BZOJ_1028_[JSOI2007]_麻将_(模拟+贪心)
  • 原文地址:https://www.cnblogs.com/watalo/p/13763121.html
Copyright © 2011-2022 走看看