微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

vs代码中特定变量的自定义着色

如何解决vs代码中特定变量的自定义着色

如果插入到自定义方法中,我想突出显示 this 参数

// class Warlock
shout(this: Warlock){
        console.log(this.name)
    }

使用范围


language    typescript
standard token type Other
foreground  #A9B7C6
background  #2B2B2B
contrast ratio  6.92

semantic token type parameter
modifiers   declaration
foreground  variable.parameter
variable
{ "foreground": "#A9B7C6" }


textmate scopes 

variable.language.this.ts
variable.parameter.ts
Meta.parameters.ts
Meta.method.declaration.ts
Meta.class.ts
source.ts


我尝试将 variable.language.this.ts 插入 settings.JSON

 "editor.tokenColorCustomizations": {

      // unter Inspect Editor Tokens and Scopes
      // auswählen und auf item clicken

      "textMateRules": [



{
  "name": "Other","textmate scopes": "variable.language.this.ts","settings": {
      "foreground": "#DB6EA6",// special case
  }
},]


这给了我这个错误 Error :Property textmate scopes is not allowed

有没有办法改变这个特定变量的颜色?

解决方法

  "editor.tokenColorCustomizations": {
    "textMateRules": [
      { "scope":"variable.language.this.ts","settings": {"foreground": "#DB6EA6"}
      }
    ]
  },

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。