Rust-Analyzer: Semantic Syntax Highlighting does not work in VS Code

The syntax highlighting does not work on my machine in VS Code. And it currently looks like this for example:
image

As seen in the image only key words and parenthesis are highlighted, all other identifiers and so on are white.

I have tried the following things:

  • Running rust-analyzer analysis-stats ., results in no error and works fine
  • Reinstalling the extension
  • Turning semantic syntax highlighting on and off in the settings

Each output in VS-Code shows no error, but I am not entirely sure of the output of Rust Analyzer Language Server Trace, so here is the output of it: Rust Analyzer Language Server Trace · GitHub

Does anyone know why the Syntax Highlighting does not work proberly?

It looks like vscode requested the semantic highlighting results several times before analysis was complete, but failed to do so after it was done. Does switching between files fix it? Also which theme are you using? Some don't support semantic highlighting.

Changing files and projects changes nothing.

I am using the standard Dark (Visual Studio) theme.

Not sure in that case. Unless someone else answers here I would suggest opening an issie at Issues · rust-lang/rust-analyzer · GitHub.

Oh, the I think the default theme is Dark+ and with this theme it works.

Big thanks for your quick help.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.