VsCode 使用 koroFileHeader 配置作者信息、及函数注释

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",
}
koroFileHeader是一个在VSCode使用的代码注释插件,它可以帮助开发者生成文件头部注释函数注释。该插件具有强大的功能,支持所有主流语言,并且使用起来非常方便。通过安装koroFileHeader插件,你可以在编写代码的过程中快速生成规范的注释,提高代码的可读性和可维护性。你可以按照以下步骤来安装和配置koroFileHeader插件:首先,在VSCode中搜索并安装koroFileHeader插件。然后,在项目的根目录下创建.vscode文件夹,并在该文件夹下创建一个名为.vscode文件的json文件。在这个json文件中,配置好你想要生成的注释格式和内容。例如,你可以设置作者、创建时间、最后更新时间等信息配置完成后,你可以在需要注释的地方使用快捷键或命令来生成注释。通过使用koroFileHeader插件,你可以提高代码的可读性,并且减少编写注释的时间和工作量。引用<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [【VSCode注释插件:koroFileHeader】](https://blog.csdn.net/tinson12321/article/details/125366346)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值