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"
}
}
}
}
2
Answers
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.
rust
language setting insettings.json
and enable it