作者:Bread
链接:https://www.zhihu.com/question/263443346/answer/1289172503
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
链接: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”,就会出来:
便出现了函数的注释。