一、文件头注释、函数注释插件koroFileHeader
koroFileHeader搜索安装,重启VsCode即可使用:
快捷键:Ctrl + Alt +I 生成头部注释,Ctrl + Alt + T 生成函数注释
默认头部注释:
koroFileHeader还提供有一些注释图案:
Ctrl + Shift + P,F1 打开命名面板,如下图输入,就能插入插件带的注释图案了。
自定义注释模板:
打开设置(Crtl + ,)搜索 FileHeader
设置文件里加入:
"fileheader.customMade": {
//快捷键:ctrl + alt + i 生成头部注释"Author": " ","Date": "Do not edit","Email": " ","LastEditors": " ","LastEditTime": "Do not edit","Description": "","version": " ",},"fileheader.cursorMode": {
//快捷键:ctrl + alt + t 生成函数注释"name":"","msg":"","param":"","return":""},
我的:
二、注释行小插件Better Comments:
效果图:
在设置文件里加入自定义注释行类型、颜色代码重启即可:
如:
"better-comments.tags": [{
"tag": "!","color": "#FF2D00","strikethrough": false,"underline": false,"backgroundColor": "transparent","bold": false,"italic": false},{
"tag": "//","color": "#474747","strikethrough": true,"underline": false,"backgroundColor": "transparent","bold": false,"italic": false},{
"tag": "*","color": "#98C379","strikethrough": false,"underline": false,"backgroundColor": "transparent","bold": false,"italic": false},{
"tag": ":","color": "#54f","strikethrough": false,"underline": false,"backgroundColor": "transparent","bold": false,"italic": false},{
"tag": "?","color": "#3498DB","strikethrough": false,"underline": false,"backgroundColor": "transparent","bold": false,"italic": false},{
"tag": "@","color": "#FF8C00","strikethrough": false,"underline": false,"backgroundColor": "transparent","bold": false,"italic": false},{
"tag": "#","color": "#98f","strikethrough": false,"underline": false,"backgroundColor": "transparent","bold": false,"italic": false},{
"tag": "->","color": "#5f9","strikethrough": false,"underline": false,"backgroundColor": "transparent","bold": false,"italic": false},{
"tag": ">","color": "yellow","strikethrough": false,"underline": false,"backgroundColor": "transparent","bold": false,"italic": false},{
"tag": "=>","color": "blue","strikethrough": false,"underline": false,"backgroundColor": "transparent","bold": false,"italic": false},{
"tag": "todo","color": "#fffae5","strikethrough": false,"underline": false,"backgroundColor": "transparent","bold": false,"italic": false}],
配置过程:也是进入刚刚那个配置文件,添加上面源代码。
可以 打开设置(Crtl + ,)直接搜索 better:
或者从拓展插件的设置 进入: