gpt4 book ai didi

visual-studio-code - 我可以在 VSCode 扩展中设置 editor.tokenColorCustomizations 吗?

转载 作者:行者123 更新时间:2023-12-05 03:52:06 26 4
gpt4 key购买 nike

我正在为我在工作中使用的专有语言开发语言支持插件。我们经常访问深层嵌套对象的属性,例如This.isa.Really.Long.Variable.Name.ActualValue 所以这些代码变得非常密集。我的想法是将 TextMate 范围应用于最后一个点之前的所有内容,并将颜色更改为部分透明的白色,使其淡入背景。

我已经在我的编辑器设置中成功添加了一条规则来更改我创建的 TextMate 范围的颜色。

"editor.tokenColorCustomizations": {
"textMateRules": [{
"scope": "support.variable.long.myLang",
"settings": {
"foreground": "#ffffff90",
"fontStyle": "italic"
}
}]
}

但是,将此规则添加到我的扩展程序中的“configurationDefaults”不起作用,它会警告“未知的编辑器配置设置”。我可以设置其他编辑器设置就好了。

有没有办法做到这一点?或者是否已经有一个通常与淡出文本相关的 TextMate 范围?或者在 VScode 中淡化/隐藏部分行的任何其他方法?

最佳答案

这应该是可能的,在这里我给你一个我的扩展的例子,为我的新范围定义颜色。正常工作。

"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"
}
}
]
}
}
}

关于visual-studio-code - 我可以在 VSCode 扩展中设置 editor.tokenColorCustomizations 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62355617/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com