【问题标题】:VS Code: Is it possible to specify a token color customization that requires multiple scopes at once?VS Code:是否可以指定一次需要多个范围的令牌颜色自定义?
【发布时间】:2021-12-07 03:00:14
【问题描述】:

VS Code 允许用户在settings.jsoncustomize syntax highlighting colors for specific syntax。最灵活的方法是使用"textMateRules" 属性, 其格式如下:

"editor.tokenColorCustomizations": {
  "textMateRules": [{
    "scope": ["keyword.other", "keyword.control"],
    "settings": {
      "foreground": "#FF0000",
      "fontStyle": "bold"
    }
  }]
}

上述 sn-p 的问题在于它将所选样式应用于 keyword.otherkeyword.control 范围。 是否可以设计一个需要keyword.otherkeyword.control 范围的textMateRules 配置?

【问题讨论】:

    标签: visual-studio-code vscode-settings


    【解决方案1】:

    另见https://stackoverflow.com/a/64836542/836330

    使用这个表格:

    "editor.tokenColorCustomizations": {
      "textMateRules": [{
        "scope": "keyword.other keyword.control",
        "settings": {
          "foreground": "#FF0000",
          "fontStyle": "bold"
        }
      }]
    }
    

    "scope": "keyword.other keyword.control", // note separated by a space, one string

    此表单需要 BOTH 范围才能应用。

    【讨论】:

      猜你喜欢
      • 2012-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-18
      • 1970-01-01
      • 1970-01-01
      • 2011-08-09
      • 1970-01-01
      相关资源
      最近更新 更多