vscode函数注释添加【转载】
作者:Bread
链接:https://www.zhihu.com/question/263443346/answer/1289172503
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
![](https://pic4.zhimg.com/80/v2-68a3c21e365f39f81726cbcf3ca64e42_720w.jpg)
![](https://pic4.zhimg.com/80/v2-29822f793b1938cb563fe24559fbdd0e_720w.jpg)
![](https://pic3.zhimg.com/80/v2-633c109ab8ef7a86f90188641c9173f9_720w.jpg)
链接:https://www.zhihu.com/question/263443346/answer/1289172503
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
不需要使用插件,在 设置->用户代码片段
![](https://pic4.zhimg.com/80/v2-68a3c21e365f39f81726cbcf3ca64e42_720w.jpg)
![](https://pic2.zhimg.com/80/v2-dba80e74d3c6b55eafffcc40074ca0c8_720w.jpg)
选择你想要注释的程序语言,我这里以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": [
"\"\"\"",
"\r",
"Arguments",
"---------",
"\r\r",
"Returns",
"-------",
"\r",
"\"\"\"",
"",
"$0"
],
}
}
接着在一个空白的python文件中,打“header”就会出现:
![](https://pic4.zhimg.com/80/v2-29822f793b1938cb563fe24559fbdd0e_720w.jpg)
![](https://pic1.zhimg.com/80/v2-a17dc3d7a92b3c3f75c7b71902d681e3_720w.jpg)
就完成了文件头部注释。
最后对于函数,同理,在函数下面打“function”,就会出来:
![](https://pic3.zhimg.com/80/v2-633c109ab8ef7a86f90188641c9173f9_720w.jpg)
![](https://pic2.zhimg.com/80/v2-53af7f9b3498d629ceab44603f8c0a94_720w.jpg)
便出现了函数的注释。
微信搜索“Kconfig”,获取支持...