当前位置: 代码迷 >> 综合 >> vs Code环境配置Better Comments、koroFileHeader 插件
  详细解决方案

vs Code环境配置Better Comments、koroFileHeader 插件

热度:35   发布时间:2023-11-25 16:28:10.0

一、文件头注释、函数注释插件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:

在这里插入图片描述

或者从拓展插件的设置 进入:

在这里插入图片描述
在这里插入图片描述

放入自定义注释行类型 代码:

在这里插入图片描述

文件中使用:

在这里插入图片描述

  相关解决方案