【问题标题】:Is it possible to assign different colours to certain XML tags in VS Code?是否可以为 VS Code 中的某些 XML 标签分配不同的颜色?
【发布时间】:2020-04-09 11:04:08
【问题描述】:

我有一个相当长的 XML 文档,我希望某些标签以某种颜色显示(例如每个标签都应该是红色的) 在 Visual Studio 中是否有插件或方法可以做到这一点代码?

【问题讨论】:

标签: xml visual-studio-code vscode-settings color-scheme


【解决方案1】:

使用命令面板中的scopes inspector,您将看到 xml 标记具有以下范围:

entity.name.tag.localname.xml
meta.tag.xml
text.xml

因此,将其放入您的设置中会改变您的标签颜色:

 "editor.tokenColorCustomizations": {

    "textMateRules": [

      {
        "scope": "entity.name.tag.localname.xml",
        "settings": {
          "foreground": "#f00",
          // "fontStyle": "underline"
        }
      }
  }

【讨论】:

  • 所以,这就是我可以更改每个标签的颜色的方法,对吧?例如,我只想更改 标签,但其他标签保持与它们相同的颜色。有没有办法做到这一点?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-07-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-25
  • 1970-01-01
相关资源
最近更新 更多