What Is This Added Text and How Do I Hide It?

The rust-analyzer in Visual Studio Code is displaying text that isn't in the file. It is the white text in the image below. How do I hide the extra text (without disabling rust-analyzer), and what is this feature named?

(I'm new to Rust, and I'm sure it will be immensely useful to see this content at some point, but as a newbie, it is confusing for VSCode to show text that isn't in the examples I'm working from.)

This is called inlay hints. In your screenshot it shows the types of variables, names of arguments and return types in chained method invocations. Note that it normally isn't as obnoxious, but your theme seems to give them quite a distracting look. This is what it looks in another theme:

It just shows a gray text that is slightly smaller than the code with the background matching regular code. https://rust-analyzer.github.io/manual.html#color-configurations has a list of configs you can use to tweak the look of the inlay hints.

If you want to disable inlay hints you can use the editor.inlayHints.enabled config.

1 Like

Perfect. Thank you.

I have the setting on toggle, so that I can press Ctrl+Alt whenever I want to see it.

1 Like