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

     

  • 相关阅读:
    AutoLISP圆内接多边形
    AutoLISP以直线为基线添加文字
    jquery easyuidatagrid 如何清空数据
    MyBatis直接执行SQL查询及批量插入数据
    mappers文件中的#{}语法与${}语法的区别
    在windows7桌面上新建一个快捷方式,指向cmd命令窗口
    ResultSet转换List或直接遍历解决null问题
    linux命令
    flash build 4.6 报错 内存不足,无法加载...
    关于linux安装openoffice无法启动
  • 原文地址:https://www.cnblogs.com/watalo/p/13763121.html
Copyright © 2011-2022 走看看