问题:关于Better Comments默认在html、TS、JS中有效,在vue中无效,需要单独进行配置
windows系统可以参考友链Better Comments(注释高亮)在vue文件里失效的问题
关于Better Comments电脑的配置路径:
Windows系统:C:\Users\你的用户名.vscode\extensions -> aaron-bond.better-comments-版本号 -> out -> parser.js
macOS系统:/Users/你的用户名/.vscode/extensions -> aaron-bond.better-comments-版本号 -> out -> parser.js
详细修改文件路径参考: .vscode -> .extensions -> aaron-bond.better-comments-版本号 -> out -> parser.js
以mac os系统为🌰:首先打开电脑自带终端(熟悉终端命令直接跳过按照详细路径一直进入到parser.js进行修改即可)
cd ~ //跳转到根目录
ls -a //查看根目录下的 .vsCode
cd .vsCode // 效果如下图所示,按照上面提供的详细路径一路cd到parser.js文件即可
继续进入选中的目录,cd out //能够看到parser.js 可以直接拖拽到vsCode打开或者通过命令vim修改 效果如下图所示:
setDelimiter函数的switch中添加以下代码: 效果如下图所示:
case "vue":
this.setCommentFormat("//", "/*", "*/")
break;
最后一步:保存修改文件,关闭vsCode,重启即可在.vue文件中使用Better Comments来写注释内容
拓展:关于自己的Better Comments配置文件参考:可以复制直接使用或自定义即可
"better-comments.tags": [
{
"tag": "!!",
"color": "#FF2D00",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "todo",
"color": "#FF2D00",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "TODO",
"color": "#FF2D00",
"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": "#474747",
"strikethrough": true,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "!",
"color": "#FF8C00",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "info",
"color": "#CCFFFF",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "tip",
"color": "#CCFFFF",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "important",
"color": "#FFFFCC",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "example",
"color": "#FFFFCC",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "future",
"color": "#CCFFFF",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "未完成",
"color": "#FFFFCC",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "@",
"color": "#CCFFFF",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "test",
"color": "#FFFFCC",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "warn",
"color": "#FFFFCC",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "step",
"color": "#FFFFCC",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "^",
"color": "#FFFFCC",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "fail",
"color": "#FFFFCC",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
},
{
"tag": "***",
"color": "#98C379",
"strikethrough": false,
"underline": false,
"backgroundColor": "transparent",
"bold": false,
"italic": false
}
],