在 VS Code 中更改 json 文件关键字或注释的颜色

Change color of json file keywords or comments in VS Code

我想自定义评论或关键字的颜色(不知道它们叫什么,但我在附图中描述了它们。)那么如何使用“editor.tokenColorCustomizations”更改它们的颜色vs code.(红色代码需要修改)

使用命令面板中的 Scopes 检查器,单击那些 json 键,您将看到它们的范围。在你的 settings.json:

中可以这样使用
  "editor.tokenColorCustomizations": {
    "textMateRules": [
      {
        "scope": "support.type.property-name.json.comments",
        "settings": {
          "foreground": "#00ff00",
          "fontStyle": "bold",
        }
      }
    ]
  }

如果您想将上述更改限制为特定的颜色主题,请使用以下形式:

```jsonc
  "editor.tokenColorCustomizations": {
    "[Monokai Classic]": {              // your theme name here
      "textMateRules": [
        {
          "scope": "support.type.property-name.json.comments",
          "settings": {
            "foreground": "#00ff00",
            "fontStyle": "bold",
          }
        }
      ]
    }
  }