zoukankan      html  css  js  c++  java
  • vscode函数注释添加【转载】

    作者:Bread
    链接:https://www.zhihu.com/question/263443346/answer/1289172503
    来源:知乎
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

    不需要使用插件,在 设置->用户代码片段

    选择你想要注释的程序语言,我这里以python为例:

    然后按下面格式写一下并保存:

    {
    	// 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:
    	// "Print to console": {
    	// 	"prefix": "log",
    	// 	"body": [
    	// 		"console.log('$1');",
    	// 		"$2"
    	// 	],
    	// 	"description": "Log output to console"
    	// }
    	"HEADER": {
            "prefix": "header",
            "body": [
                "# -*- encoding: utf-8 -*-",
                "'''",
                "Filename         :$TM_FILENAME",
                "Description      :",
                "Time             :$CURRENT_YEAR/$CURRENT_MONTH/$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
                "Author           :***",
                "Version          :1.0",
                "'''",
                "",
                "$0"
            ],
        },
        "function":{
            "prefix": "function",
            "body": [
                """"",
                "
    ",
    
                "Arguments",
                "---------",
                "
    
    ",
                "Returns",
                "-------",
                "
    ",
                """"",
                "",
                "$0"
            ],
        }
    }

    接着在一个空白的python文件中,打“header”就会出现:

    就完成了文件头部注释。

    最后对于函数,同理,在函数下面打“function”,就会出来:

    便出现了函数的注释。

  • 相关阅读:
    SOJ 2785_Binary Partitions
    Codeforces Round #328 (Div. 2)
    C++ fill 和memset
    SOJ 2749_The Fewest Coins
    Codeforces Round #327 (Div. 2)
    TYVJ P1013 找啊找啊找GF Label:动态规划
    TYVJ 1014 乘法游戏
    TYVJ 1011 NOIP 2008&&NOIP 2000 传纸条&&方格取数 Label:多线程dp
    错误集合
    TYVJ P1038/P1039 忠诚 标签:线段树
  • 原文地址:https://www.cnblogs.com/DawaTech/p/13186750.html
Copyright © 2011-2022 走看看