【问题标题】:VS Code Highlight Text Mate Rules PriorityVS Code 高亮文本匹配规则优先级
【发布时间】:2021-08-12 13:17:23
【问题描述】:

有没有办法让meta.function-call 文本匹配规则优先于entity.name.function

在 VS Code Crystal(类 Ruby 语言)中设置方法定义和方法调用,并用 entity.name.function 标记标记。

我希望方法定义为粗体,但方法调用不为粗体。但它不起作用,因为我不能用meta.function-call 覆盖entity.name.function

我的setting.json

{
  "editor.tokenColorCustomizations": {
    "textMateRules": [
      {
        "scope": [
          "entity.name.function"
        ],
        "settings": { "foreground": "#3730A3", "fontStyle": "bold" }
      },
      {
        "scope": [
          "meta.function-call"
        ],
        "settings": { "foreground": "#111827", "fontStyle": "" }
      }
    ]
  }
}

【问题讨论】:

    标签: visual-studio-code crystal-lang


    【解决方案1】:

    指定由空格分隔的多个范围:

    {
        "name": "function definition",
        "scope": [
            "entity.name.function"
        ],
        "settings": {
            "foreground": "#ff0000"
        }
    },
    {
        "name": "function call",
        "scope": [
            "meta.function-call entity.name.function"
        ],
        "settings": {
            "foreground": "#0000ff"
        }
    },
    

    【讨论】:

      猜你喜欢
      • 2022-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-03
      • 2010-09-28
      • 2021-05-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多