Rust-analyzer VSCode error tooltips

When using the rust-analyzer extension for VSCode, when there is an underlined error/warning, putting the mouse over the error still shows the documentation. The error tooltip only shows if you put the pointer slightly before the token, on punctuation or on some value like a parameter that isn't linked to any documentation, which is a bit finicky. Anyone know of a way to make it "prefer" the error as it does with most other types of files?



You may find "Error Lens" useful.(an extension)

1 Like

The error is still shown when there is documentation, but it is put after the documentation. You need to scroll down in the tooltip to see this. This is not something rust-analyzer can change. Vscode decided to do this. There is an issue open to swap them (For long hovers, errors appear all the way at the bottom and require scrolling · Issue #73120 · microsoft/vscode · GitHub), but it doesn't seem like it has any priority.


Thanks, I didn't notice it was scrollable. It's funny that I've never noticed this in other languages, but I guess it's not really common in a lot of languages. E.g. in TypeScript, a method call is usually only underlined if it's not a valid name, and thus has no documentation. The only valid case would be calling a private method, which is less likely to have docs as well.

Rust-analyzer underlines methods and variables depending on mutability. In this case push mutates the values vec and as such push gets underlined. You can change this in the semantic highlighting settings.

Yeah, that was just an example. I was just musing about the nature of languages making this behavior more/less visible. :wink:

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.