1、安装 koroFileHeader 插件
2、配置settings.json文件
左下角设置 —>设置—>输入@ext:obkoro1.korofileheader–>打开settings.json文件
还有一个快速的方法:
首选项-设置-搜索setting.json,就可以打开setting.json文件了
打开文件后:
修改自己想要的信息
{
"fileheader.customMade": { // 此为头部注释
"Author": "xx", // 文件作者
"Date": "Do not edit", // 文件创建时间
"LastEditors": "Do not edit", // 最后编辑文件的人
"LastEditTime": "Do not edit", // 文件最后编辑时间
"Description": "", // 文件描述
"FilePath": "Do not edit", // 文件在项目中的相对路径 自动更新
},
"fileheader.cursorMode": { //此为函数注释
"description":"", // 功能描述
"param": "", // 传入参数
"return": "", // 返回结果
"author":"wuyue.nan" // 函数作者
}
}
3、在文件中实现作者的注释信息
快捷键:ctrl + win + i // 生成头部注释
快捷键:ctrl + win + t // 生成函数注释
<!--
* @Author: xx
* @Date: 2022-09-28 15:24:31
* @LastEditors: Do not edit
* @LastEditTime: 2022-11-08 09:56:16
* @Description: www
* @FilePath: \interface-data\src\views\systemconfig\index.vue
-->
/**
* @description: www
* @return {*}
* @author: wuyue.nan
*/
4、配置代码自动对齐、作者信息的一套设置setting.json
{
// Editor
"editor.accessibilitySupport": "off",
"editor.bracketPairColorization.enabled": true,
"editor.codeActionsOnSave": {
"source.fixAll": false,
"source.fixAll.eslint": true,
"source.organizeImports": false
},
"editor.colorDecorators": true,
"editor.columnSelection": false,
"editor.cursorSmoothCaretAnimation": "on",
// "editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.find.addExtraSpaceOnTop": false,
"editor.find.seedSearchStringFromSelection": "always",
"editor.foldingStrategy": "indentation",
"editor.formatOnPaste": false,
"editor.glyphMargin": true,
"editor.inlineSuggest.enabled": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.snippetSuggestions": "top",
"editor.suggestSelection": "first",
"editor.tabSize": 2,
"editor.unicodeHighlight.allowedCharacters": {
":": true
},
"editor.unicodeHighlight.ambiguousCharacters": false,
"editor.unicodeHighlight.invisibleCharacters": false,
"editor.wordSeparators": "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?",
"diffEditor.ignoreTrimWhitespace": false,
// Debug
"debug.javascript.autoAttachFilter": "disabled",
// Explorer
"explorer.confirmDelete": false,
"explorer.confirmDragAndDrop": false,
// Window
"window.title": "${activeEditorLong}${separator}${rootName}",
"workbench.list.smoothScrolling": true,
"workbench.editor.highlightModifiedTabs": true,
"breadcrumbs.enabled": false,
"breadcrumbs.filePath": "last",
// Files
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.simpleDialog.enable": true,
// Search
"search.followSymlinks": false,
"search.exclude": {
"**/.git": true,
"**/.github": true,
"**/.nuxt": true,
"**/.output": true,
"**/.pnpm": true,
"**/.vscode": true,
"**/.yarn": true,
"**/bower_components": true,
"**/dist/**": true,
"**/logs": true,
"**/node_modules": true,
"**/out/**": true,
"**/package-lock.json": true,
"**/pnpm-lock.yaml": true,
"**/tmp": true,
"**/yarn.lock": true
},
// Extensions
"extensions.ignoreRecommendations": true,
"extensions.autoUpdate": "onlyEnabledExtensions",
// Extensions - CSS
"less.validate": false,
"css.validate": false,
"css.lint.unknownAtRules": "ignore",
"css.lint.hexColorLength": "ignore",
// Extensions - Emmet
"emmet.showSuggestionsAsSnippets": true,
"emmet.triggerExpansionOnTab": false,
// Extensions - Error Lens
"errorLens.enabledDiagnosticLevels": [
"warning",
"error"
],
"errorLens.excludeBySource": [
"cSpell",
"Grammarly",
"eslint"
],
// Extensions - ESLint
"eslint.codeAction.showDocumentation": {
"enable": true
},
"eslint.quiet": true,
"eslint.validate": [
"javascript",
"typescript",
"javascriptreact",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"json5"
],
// Extensions - Git
"git.enableSmartCommit": true,
"git.confirmSync": false,
"gitlens.hovers.enabled": false,
"gitlens.mode.statusBar.enabled": false,
"gitlens.codeLens.enabled": false,
"gitlens.statusBar.enabled": false,
// Extensions - Prettier
"prettier.enable": false,
"prettier.semi": false,
"prettier.singleQuote": true,
"prettier.bracketSameLine": true,
"prettier.printWidth": 200,
"prettier.trailingComma": "all",
// Extensions - Volar
"volar.autoCompleteRefs": false,
"volar.codeLens.pugTools": false,
"volar.codeLens.scriptSetupTools": true,
"volar.preview.transparentGrid": false,
"volar.codeLens.references": false,
"volar.completion.preferredTagNameCase": "pascal",
"bracketPairColorizer.depreciation-notice": false,
// koroFileHeader
"fileheader.customMade": {
"Author": "XXX",
"Date": "Do not edit",
// "LastEditTime": "Do not edit",
"LastEditors": "XXX",
"Description": "description"
},
"[vue]": {
"editor.defaultFormatter": "Vue.volar"
},
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"vue.features.codeActions.savingTimeLimit": 1000,
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[less]": {
"editor.defaultFormatter": "stylelint.vscode-stylelint"
},
"workbench.colorTheme": "One Dark Pro",
// 字体
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"window.zoomLevel": 1,
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"workbench.editor.empty.hint": "hidden",
}