rust-lang / rust-lang/rust-analyzer
Feature: smart order of cargo diagnostics
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
It seems that currently diagnostics are sorted by file path. This order isn't very useful when one wants to refactor some low-level modules (and their API is changed), because higher-level modules get errors too, and these errors are unactionable (One can't fix high-level code because they haven't updated low-level code yet).
I'd propose the following algorithm to determine better readable diagnostic order:
- Build an oriented graph, where each vertex corresponds to a source file, and edge
u -> vexists if the fileureferences filev(e.g. mentions an item defined inv). - Find any topological sorting of this graph.
- When return diagnostics, sort them using source file's position in the sorting as a comparison key.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing where rust-analyzer currently orders diagnostics by source-file path. Study how file-reference relationships could provide the directed graph, then determine how to handle cycles and disconnected files. Done means diagnostics are returned in a useful topological order so lower-level errors precede dependent higher-level errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100