Rust-analyzer: How to make VS Code show lints/errors before documentation during mouse hover

I encountered this situation many times. There is an error in a line, so I want to use my mouse to inspect the error message, but the items' documentation keep getting in the way.

1 Like

You can get better readable error messages by pressing F8/Alt+F8 (not entirely sure what exactly the difference is). So instead of hover, just click to place your cursor at/before the error and press Alt+F8.

I personally also like keeping a terminal window open next to vscode to display the “ordinary” rustc output. I recently found the tool bacon which has some advantages over cargo watch, so I’ll have the command bacon clippy running in my terminal.

1 Like

If you use vscode, here's a language agnostic extension I like very much :

Error Lens

It shows errors inline with the code and pairs nicely with rust-analyzer and many other LSP extensions (and any diagnostics extensions). You can then hover the mouse over the inline error and it will only show the error, not the rustdoc.

4 Likes

To answer the question directly, you can't currently. It's something we all want, but is blocked upstream.

1 Like