在vscode中用于生成文件头部注释和函数注释的插件,经过多版迭代后,插件:支持所有主流语言,功能强大,灵活方便,文档齐全,食用简单!
安装
vscode 插件市场找到 korofileheader 注释插件,安装即可。
配置
依次点击 File → Preferences → Settings, 搜索setting.json
打开setting.json文件,添加如下配置:
"fileheader.customMade": { //此为头部注释
"Description": "",
"Version": "2.0",
"Autor": "lhl",
"Date": "Do not edit",
"LastEditors": "lhl",
"LastEditTime": "Do not edit"
},
"fileheader.cursorMode": { //此为函数注释
"description": "",
"param": "",
"return": "",
"author": "lhl"
},
"fileheader.configObj": {
"autoAdd": true, // 默认开启自动添加头部注释,当文件没有设置头部注释时保存会自动添加
"autoAlready": true, // 默认开启
"prohibitAutoAdd": [
"json",
"md"
], // 禁止.json .md文件,自动添加头部注释
"wideSame": false, // 设置为true开启
"wideNum": 13 // 字段长度 默认为13
}
实现
添加文件头 注释 ctrl+alt+i
添加函数 注释 ctrl+alt+t
效果
效果如下:
/*
* @Description: 添加文件头描述
* @Author: zugelu
* @Date: 2021-07-08 14:33:10
* @LastEditors: zugelu
* @LastEditTime: 2021-07-08 15:03:11
*/
/**
* @description: 添加函数头描述
* @param {*} context
* @return {*}
* @author: zugelu
*/
function hello (context) {
console.log(content);
return context
}