rust-lang / rust-lang/rust-analyzer

Diagnostic hovers contain duplicated information

Open
#15,722 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

image

I noticed many diagnostic hovers have an "original diagnostic" section that contains duplicate information to the main section, in this case "you might have meant to introduce a new binding: let ".

According to: https://github.com/rust-lang/rust-analyzer/blob/b1f89a84ab350091e6c20cfe30c2fab8d76b80e4/crates/rust-analyzer/src/diagnostics/to_proto.rs#L465-L470 that's intantional but it looks like vscode renders the original diagnostic just fine, so maybe this can be removed?

Edit:
Another thing I noticed is that the top E0425 takes you to https://doc.rust-lang.org/error_codes/E0425.html but the bottom one opens a vscode tab with the original cargo check message.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at crates/rust-analyzer/src/diagnostics/to_proto.rs around lines 465-470 and reproduce the diagnostic hover shown in the issue in VS Code. Compare the main and original diagnostic sections, including their error-code links; done means duplicated information is no longer shown without losing the useful diagnostic behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.