【问题标题】:VS Code: how to change color of XML attributesVS Code:如何更改 XML 属性的颜色
【发布时间】:2021-10-12 10:10:58
【问题描述】:

如何在 Visual Studio Code 中更改 XML 属性的颜色

例如,如何为下面的identifiant 属性选择另一种颜色:

以下是当前的颜色主题设置:

"editor.tokenColorCustomizations": {
    "[Solarized Dark]": {
        "keywords": "#f00"
    },
    "functions": "#f5896e",
    "numbers": "#dfd51b",
    "keywords": "#215c21",
    "strings": "#67f7e3",
    "variables": "#22FF88",
    "comments": "#332244"
}

更直观

换句话说:是否有任何标记专门适用于“XML 属性”

【问题讨论】:

    标签: xml visual-studio-code token color-scheme


    【解决方案1】:

    是的,使用 Scopes 检查器 - 调用命令 Developer: Inspect Editor Tokens and Scopes

    您将看到 xml 属性名称的范围为 entity.other.attribute-name.localname.xml。因此,您可以将此 textmate 规则添加到您的 editor.tokenColorCustomizations 设置中:

      "editor.tokenColorCustomizations": {
    
            "textMateRules": [
              {
                "scope": "entity.other.attribute-name.localname.xml",
                "settings": {
                  "foreground": "#f3873f",
                  "fontStyle": "italic"
                }
              },
            ]
      }
    

    请参阅textmate scopes 了解更多信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-24
      • 1970-01-01
      • 1970-01-01
      • 2022-01-21
      • 2020-10-03
      • 2019-08-13
      • 1970-01-01
      相关资源
      最近更新 更多