[英]Is it possible to use editor.tokenColorCustomizations in a VSCode theme?
[英]Can I set editor.tokenColorCustomizations inside a VSCode extension?
我正在为我在工作中使用的专有语言开发语言支持插件。 我们经常访问深度嵌套对象的属性,例如This.isa.Really.Long.Variable.Name.ActualValue
,因此代码变得非常密集。 我的想法是将 TextMate scope 应用于最后一个点之前的所有内容,并将颜色更改为部分透明的白色,使其淡入背景。
我已经成功地在我的编辑器设置中添加了一条规则来更改我创建的 TextMate scope 的颜色。
"editor.tokenColorCustomizations": {
"textMateRules": [{
"scope": "support.variable.long.myLang",
"settings": {
"foreground": "#ffffff90",
"fontStyle": "italic"
}
}]
}
但是,将此规则添加到我的扩展中的“configurationDefaults”不起作用,它会警告“未知的编辑器配置设置”。 我可以很好地设置其他编辑器设置。
有没有办法做到这一点? 或者是否已经存在通常与淡出文本相关的 TextMate scope? 或者任何其他方式来淡入/隐藏 VScode 中的部分行?
应该是可以的,这里我给你一个我的扩展的例子,定义colors到我的新作用域。 工作正常。
"contributes": {
"configurationDefaults": {
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "my-extension.constants",
"settings": {
"foreground": "#b180a9"
}
},
{
"scope": "my-extension.variables",
"settings": {
"foreground": "#2ebe82"
}
},
{
"scope": "my-extension.translations",
"settings": {
"foreground": "#64a1f1"
}
},
{
"scope": "my-extension.store",
"settings": {
"foreground": "#b3b6b9"
}
}
]
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.