rust-lang / rust-lang/rust-analyzer

UX: highlight the diff when a signature mismatch occurs

Open
#4,077 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics A-vscode C-enhancement S-unactionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Today I made a typo in my function signatures. It took me longer than I wanted to identify I was missing an &mut. The command line output of rustc handles this rather nicely: it renders the mismatched signatures using bold text. It'd be great if rust-analyzer could similarly apply render tricks to draw attention to the diff.

Another thing that stands out is that the signature diffs in rust-analyzer are not aligned, which makes it harder to scan for differences. I'm not sure to which degree VS Code allows for this, but if it it's at all possible it would be a huge boon.

Thanks!

Screenshots

Command line output

The missing &mut stands out clearly here and I can proceed immediately to fixing it. Also notice how the signatures are aligned.

Screenshot 2020-04-21 20 04 43

Rust-analyzer output

Spotting the missing &mut took me about 30 seconds, getting me out of my flow of writing code.

Screenshot 2020-04-21 20 03 15

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 by investigating rust-analyzer’s signature-mismatch diagnostic rendering and the VS Code/LSP capabilities mentioned in the report. Done means differing signature text is visually emphasized and the signatures are aligned enough to scan, matching the improvements illustrated by the supplied screenshots.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.