How to change VisualStudioCode comment color with

2020-04-08 11:16发布

I added this code to my setting.json

"editor.tokenColorCustomizations": {
    "comments": "#00ff00"
}

But It doesn't change the color for slashes as you can see the below screenshot.
It remains still grayed.

How can I change the whole comment color contains slashes?

enter image description here

2条回答
smile是对你的礼貌
2楼-- · 2020-04-08 12:02

The comments definition (// or # for other languages) can be customized with the punctuation.definition.comment scope in the textMateRules array.

Example:

"editor.tokenColorCustomizations": {
  "[Material Theme Darker High Contrast]": { // optional name of a specific theme
    "textMateRules": [
      {
        "scope": "punctuation.definition.comment",
        "settings": {
          "foreground": "#00ff00"
        }
      }
    ]
  }
}

You can see the scopes of all the command Inspect TM Scopes in the command palette.

查看更多
The star\"
3楼-- · 2020-04-08 12:04

It looks like the comment punctuation colorCustomization may be corrected - that is, the punctuation like // may be included in the comment scope in the October 2018 release. It is an open issue but was added to the October 2019 milestone, see https://github.com/microsoft/vscode/milestone/102.

So that the comment punctuation would no longer need to be separately colored.

It is fixed in the Insider's Build as of October 25, 2019 so that

"editor.tokenColorCustomizations": {
    "comments": "#00ff00"
}

will color the comment body and punctuation/marker as well.

查看更多
登录 后发表回答