skip to Main Content

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


  1. Chosen as BEST ANSWER

    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.


    • disable it in User/Global setting
    • create a rust language setting in settings.json and enable it
      "editor.semanticHighlighting.enabled": false,
      "[rust]": {
        "editor.semanticHighlighting.enabled": true
      }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search