• 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",
            ]
        }
    }

     

  • 相关阅读:
    CCF 小明放学 201812-2(简单模拟)
    CSP 小明上学 201812-1 (水题)
    201903-4 消息传递接口(队列模拟)
    Betsy's Tour 漫游小镇(dfs)
    Checker Challenge跳棋的挑战(n皇后问题)
    Money Systems 货币系统(母函数)
    中国剩余定理(模板+详解)
    Biorhythms(中国剩余定理(模板题))
    输入输出外挂(纯数字型)
    欧几里德(转)
  • 原文地址:https://www.cnblogs.com/watalo/p/13763121.html
Copyright © 2020-2023  润新知