Skip to content

Semantic Highlighting

Fred Bricon edited this page Apr 29, 2020 · 8 revisions

Semantic Highlighting is a new feature enabled since VS Code 1.43. Color themes can now write rules to color semantic tokens reported by this extension. If current color theme does not provide any, you can define your own rules in user settings, e.g.

"editor.tokenColorCustomizationsExperimental": {
    "variable":{
        "foreground": "#9CDCFE" // change color for tokens of type 'variable'
    },
    "*.static":{
        "fontStyle": "italic" // all tokens with modifier 'static' should be of italic style
    },
    "*.final":{
        "fontStyle": "bold" // all tokens with modifier 'final' should be of bold style
    }
}

More details in Semantic Highlighting Uncyclo Page (Token Styling).

Semantic Highlighting is controled by the java.semanticHighlighting.enabled preference. When enabled, it fixes numerous syntax highlighting issues with Java files. However, you might experience a flickering when it kicks in, as it needs to be computed by the Java Language server, when opening a new file or when typing.

Clone this wiki locally