visual-studio-code - VS Code 突出显示文本配合规则优先级

标签 visual-studio-code crystal-lang

是否有办法使 meta.function-call 文本配合规则优先于 entity.name.function

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

我希望方法定义为粗体,但方法调用为非粗体。但它不起作用,因为我无法使用 meta.function-call

覆盖 entity.name.function

enter image description here

我的setting.json:

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

最佳答案

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

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

关于visual-studio-code - VS Code 突出显示文本配合规则优先级,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68758259/

相关文章:

php - PHP打印到Visual Studio Code中的终端

visual-studio-code - 插入一个没有缩进的空行

git - 碎片包和 Crystal 要忽略什么

crystal-lang - Crystal 构建与发布选项错误

c# - 如何将 .Net Core Web Api 从 VS Code 发布到 Azure?

javascript - VS Code 中自动格式的左括号前没有空格

oracle - VS code 未检测到 Linux Mint 中的 .NET Core 运行时

binaryfiles - 如何在 Crystal 中连续读取二进制文件并从中获取字节?

api - 带有 PEM 证书的 HTTP 请求

performance - Int32 与 Float64 在 Crystal 中的表现