如何更改vs代码中注释之前和之后的字符颜色。我正在谈论或/ * * /或#字符。我知道如何更改评论颜色
How do I change color of comments in visual studio code?
但找不到任何关于“框架”字符的内容。
你可以这么简单地做到这一点。在命令面板中使用“Inspect TM Scopes
”来检查这些字符。它将为每种语言提供不同的范围,例如:
punctuation.definition.comment.js
对于javascript评论。现在您可以在用户设置中使用它,如下所示:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "punctuation.definition.comment.js",
"settings": {
"foreground": "#f00",
}
}
]
}
对于其他语言,您显然会有不同但相似的范围。
您可以使用以下内容全局定义注释颜色。你不必为每种语言都做一个!
settings.json
"editor.tokenColorCustomizations": {
"comments": "#636363",
"textMateRules": [{
"scope": "punctuation.definition.comment",
"settings": {
"foreground": "#636363",
}
}]
},
注意我从.php
行的末尾省略了语言,即:scope
。
这将同时执行注释块的开头/结尾和注释本身。当我改变我的评论颜色和/**
和*/
没有改变时,我感到困惑。这解决了它,并使评论都是一种颜色。