英文:
How to turn on VS Code's semantic highlighing only for one language?
问题
我想仅为Rust启用语义突出显示,而不是其他语言,但实际上似乎不可能。
在定义了“semanticTokenColors”之后,它会为所有语言打开语义突出显示,而不仅仅是Rust。我已经在VS Code的存储库上报告了这个问题,但到目前为止还没有回应。
我尝试将“semanticTokenColors”放在themecolor.json和settings.json中。
以下是我的当前设置:
英文:
I want to have semantic highlighting only for Rust and not other languages, but this seems not to be possible in practice.
After defining the "semanticTokenColors" it turns on semantic highlighting for all languages, not only for Rust. I've made an issue report on VS Code's repo but so far no response.
I've tried putting "semanticTokenColors" on the themecolor.json and in the settings.json.
Here are my current settings:
"editor.semanticHighlighting.enabled": false,
"[rust]": {
"editor.semanticHighlighting.enabled": true
},
"editor.semanticTokenColorCustomizations": {
"[JetBrains Darcula Theme]": {
"rules": {
"*.attribute": {
"foreground": "#BBB529"
},
"lifetime": {
"foreground": "#20999D"
},
"typeParameter": {
"foreground": "#20999D"
},
"*.mutable": {
"foreground": "#BCA5C4",
"underline": true
},
"macro": {
"foreground": "#4EADE5"
},
"macroBang": {
"foreground": "#4EADE5"
},
"enumMember": {
"foreground": "#9876AA"
},
"*.constant": {
"foreground": "#9876AA"
},
"string": {
"foreground": "#6A8759"
},
"unresolvedReference": {
"foreground": "#9876AA"
},
"operator": {
"foreground": "#abb2bf"
}
}
}
}
答案1
得分: 1
- 在用户/全局设置中禁用它
- 在
settings.json
中创建一个rust
语言设置并启用它
"editor.semanticHighlighting.enabled": false,
"[rust]": {
"editor.semanticHighlighting.enabled": true
}
英文:
- disable it in User/Global setting
- create a
rust
language setting insettings.json
and enable it
"editor.semanticHighlighting.enabled": false,
"[rust]": {
"editor.semanticHighlighting.enabled": true
}
答案2
得分: 0
"variable.readonly:java is called a selector and has the form (|tokenType)(.tokenModifier)(:tokenLanguage)?"
根据官方 VS Code 指南 ,我发现了如何在 semanticTokenColors 中指定语言的方法。
英文:
While the original issue still prevails, I found out how to specify the language in semanticTokenColors: "variable.readonly:java is called a selector and has the form (|tokenType)(.tokenModifier)(:tokenLanguage)?.", according to the official vs code guide.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论