VSCode - 更改打字稿函数装饰器的颜色

Edu*_*ida 6 syntax-highlighting decorator visual-studio-code

有没有办法在 VSCode 中更改装饰器的语法高亮颜色?鉴于小例子:

     @HostListener('mouseenter')
     onMouseEnter() {}
Run Code Online (Sandbox Code Playgroud)

双方@HostListeneronMouseEnter突出显示为相同的颜色。我想改变这一点。到目前为止,我试图搞乱"editor.tokenColorCustomizations": { "functions" : "SomeColorHere"}},但这种改变装饰和函数声明。

Sce*_*eat 5

这是我的配置,按照马克的建议使用TODO 高亮显示,我排除了这一点,以避免干扰 js 和手写笔requireimport

屏幕截图上的快速说明:default斜体样式来自此处,内联属性来自此处

"todohighlight.isEnable": true,
"todohighlight.isCaseSensitive": true,
"todohighlight.keywordsPattern": "@(?!require|import)[\\w-_.]*",
"todohighlight.defaultStyle": {
    "color": "#1E88E5",
    "backgroundColor": "0",
    "fontWeight": "bold"
},
"todohighlight.include": [
    "**/*.js",
    "**/*.ts",
    "**/*.vue",
],
"todohighlight.exclude": [
    "**/node_modules/**",
    "**/bower_components/**",
    "**/dist/**",
    "**/build/**",
    "**/.vscode/**",
    "**/.github/**",
    "**/_output/**",
    "**/*.min.*",
    "**/*.map",
    "**/.next/**"
],
"todohighlight.maxFilesForSearch": 5120,
Run Code Online (Sandbox Code Playgroud)


Mar*_*ark 1

有关如何查看语法范围的信息,请参阅检查 textmate 范围和类似内容。所以像这样的东西会改变装饰器符号的颜色@

 {
    "scope":  [
       "punctuation.decorator.js", 
        // "meta.decorator.js",
     ],

     "settings": {
        "foreground": "#e100ff",
        "fontStyle": "bold"
     }
}
Run Code Online (Sandbox Code Playgroud)

这只影响@符号,我找不到一种方法来为 @ 符号及其关联的函数名称着色,而没有其他函数名称。

如果您确实想要的话,有一个解决方法可以做到这一点。那就是使用像TODO突出显示这样的单词突出显示器并创建一个可以执行您想要的操作的正则表达式。喜欢:

"todohighlight.keywordsPattern": "@[\\w-_]*",

"todohighlight.defaultStyle": {
    "color": "red",
    // "letterSpacing": "1px",
    // "backgroundColor": "rgba(170,102,0,1)",
    "backgroundColor": "transparent",
    // "borderRadius": "4px",
    "isWholeLine": false
  }
Run Code Online (Sandbox Code Playgroud)