问题描述
我试图找出如何为单行注释指定一种颜色,为块注释(多行)指定另一种颜色。
以下适用于将所有评论设置为某种颜色:
"editor.tokenColorCustomizations": {
"comments" :"#ff0022",}
有没有办法单独指定它们?例如"blockComment" : "#00FF00","commentLine" : "#FF00222"
解决方法
使用 "textMateRules"
为 "comment.block"
设置范围设置,"comment.line"
可以单独设置颜色。
"editor.tokenColorCustomizations": {
"textMateRules": [{
"scope": "comment.block","settings": {
"foreground": "#0000"
}
},{
"scope": "comment.line","settings": {
"foreground": "#0000FF"
}
}],}
要更改标点符号 "punctuation.definition.comment.js"
(js):
"editor.tokenColorCustomizations": {
"textMateRules": [{
"scope": "comment.line,punctuation.definition.comment.js","settings": {
"foreground": "#00FF00"
}
}]
}