一、VS Code自动注释插件
koroFileHeader
安装插件
koroFileHeader
添加头文件注释:快捷键:window:ctrl+alt+i
,mac:ctrl+cmd+i
, linux:ctrl+meta+i
添加函数注释: 快捷键:window:ctrl+alt+t
,mac:ctrl+cmd+t
,linux:ctrl+meta+t
二、插件配置
插件配置说明:https://github.com/OBKoro1/koro1FileHeader
个人修改后的配置:
{
"editor.fontSize": 16,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 100,
"workbench.tree.indent": 25,
"C_Cpp.updateChannel": "Insiders",
"window.zoomLevel": 0,
"http.proxySupport": "off",
"markdown-preview-enhanced.HTML5EmbedUseLinkSyntax": true,
"markdown-preview-enhanced.enableCriticMarkupSyntax": true,
"markdown-preview-enhanced.enableExtendedTableSyntax": true,
"markdown-preview-enhanced.enableHTML5Embed": true,
"markdown-preview-enhanced.enableTypographer": true,
"markdown-preview-enhanced.HTML5EmbedIsAllowedHttp": true,
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"code-runner.clearPreviousOutput": true,
"code-runner.executorMap": {},
"code-runner.executorMapByFileExtension": {},
"files.encoding": "gbk",
"fileheader.configObj": {
"createFileTime": true,
"language": {
"c/cpp/h/hpp": {
"head": "/*******************************************************************",
"middle": " * @",
"end": "*******************************************************************/"
}
},
"autoAdd": false,
"autoAddLine": 100,
"autoAlready": true,
"annotationStr": {
"head": "/*",
"middle": " * @",
"end": " */",
"use": false
},
"headInsertLine": {
"php": 2,
"*":1
},
"beforeAnnotation": {
"文件后缀": "该文件后缀的头部注释之前添加某些内容"
},
"afterAnnotation": {
"文件后缀": "该文件后缀的头部注释之后添加某些内容"
},
"specialOptions": {
"特殊字段": "自定义比如LastEditTime/LastEditors"
},
"switch": {
"newlineAddAnnotation": true
},
"supportAutoLanguage": [],
"prohibitAutoAdd": [
"json",
"*"
],
"prohibitItemAutoAdd": [
"项目的全称, 整个项目禁止自动添加头部注释, 可以使用快捷键添加"
],
"moveCursor": true,
"dateFormat": "YYYY-MM-DD HH:mm",
"atSymbol": "@",
"atSymbolObj": {
"文件后缀": "修改它的@符号"
},
"colon": ": ",
"colonObj": {
"文件后缀": "修改它的冒号"
},
"filePathColon": "路径分隔符替换",
"showErrorMessage": false,
"wideSame": true,
"wideNum": 15,
"CheckFileChange": false,
"createHeader": true,
"useWorker": false,
"typeParam": false,
"designAddHead": false,
"headDesignName": "random",
"headDesign": false
},
"fileheader.cursorMode": {
"brief " : "",
"param " : "",
"return " : ""
},
"fileheader.customMade": {
"Descripttion":"",
"version":"",
"Author":"",
"Date":"Do not edit",
"LastEditTime":"Do not Edit",
},
"C_Cpp.commentContinuationPatterns": [
"/**"
],
}
注释效果如图:
头文件注释:
/*******************************************************************
* @Descripttion : 头文件注释
* @version : V1.0.0
* @Author : FangJijun
* @Date : 2020-10-12 10:14
* @LastEditTime : 2020-10-12 12:43
*******************************************************************/
函数注释:
/******************************************************************
* @brief : 函数注释
* @param : none
* @return : none
*******************************************************************/