英文:
VSCode settings : colorize custom tags that start with the "x-" prefix
问题
我想编写一个在其中以前缀 x-
开头的标签(在 .vue 文件中)将被着绿色的Visual Studio Code设置。
像<x-component></x-component>
和<x-lorem></x-lorem>
这样的标签。
是否可能?如何实现?
我尝试了这个:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "entity.name.tag.x-*",
"settings": {
"foreground": "#00ff00"
}
}
]
},
但它不起作用。
英文:
I want to write a vscode setting in which tags ( inside .vue file ) that start with the prefix x-
will be colored green.
tags like <x-component></x-component>
and <x-lorem></x-lorem>
is it possible? and how
i tried this
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "entity.name.tag.x-*",
"settings": {
"foreground": "#00ff00"
}
}
]
},
and it not works
答案1
得分: 0
抱歉,似乎在不安装插件的情况下是不可能的。
我使用了@rioV8提到的Highlight
插件
它有效果
这是我的配置:
"highlight.regexes": {
"(<[^>]*x-[^>]*>)": { // 从这个字符串创建正则表达式,不要忘记双重转义
"decorations": [ // 应用于捕获组的装饰选项
{ "color": "#7ac379" }, // 应用于第一个捕获组的装饰选项,在这种情况下是"//<-x:"
]
}
}
英文:
Unfortunately, it seems that this is not possible without installing the plugin
I used the Highlight
plugin mentioned by @rioV8
it works
this is my config :
"highlight.regexes": {
"(<[^>]*x-[^>]*>)": { // A regex will be created from this string, don't forget to double escape it
"decorations": [ // Decoration options to apply to the capturing groups
{ "color": "#7ac379" }, // Decoration options to apply to the first capturing group, in this case "//<-x:"
]
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论