如何使用 TextMate 规则为某些字符着色,以便在 vs 代码中突出显示语法

Hof*_*off 4 textmate syntax-highlighting visual-studio-code

在VS代码,我怎么可以设置颜色的花括号字符{,并}在.ts文件?

在 my 中settings.json,我目前将此作为起点:

"editor.tokenColorCustomizations": {
        "textMateRules": [{
            "scope": "entity.name.class, entity.name.type", 
            "settings": {
                "foreground": "#cc0000",
                "fontStyle": "italic",
             }
        }],
}
Run Code Online (Sandbox Code Playgroud)

jab*_*tta 5

这应该是你要找的:

"editor.tokenColorCustomizations": {
  "textMateRules": [
    {
      "scope": [
        "punctuation.definition.block.ts"
      ],
      "settings": {
        "foreground": "#ff0000"
      }
    }
  ]
},
Run Code Online (Sandbox Code Playgroud)

  • 查看有关使用命令“Inspect TM Scopes”的一些答案,以了解此答案如何到达“punctuation.definition.block.ts”范围。如/sf/ask/2948154051/#42117021 (3认同)