rust-lang / rust-lang/rust-analyzer

syntax error spans underline lots of code

Open
#8,659 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Haven't spent time minimizing, but I imagine it wouldn't be too hard.

When confronted with a syntax error, e.g., when rebasing with conflict markers, I currently see my whole editor light up with underlines and suggestions:

image

While it's definitely true that this code has syntax errors, this isn't particularly helpful -- maybe we can do something to avoid this? At least detecting conflict markers and skipping those lines entirely as a heuristic for parsing seems like an excellent step (ideally with some kind of post-hoc recovery re-starting the parse from the right place, but that seems like a stretch).

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

Reproduce the issue in the editor with a Rust file containing merge-conflict markers and observe how syntax-error underlines and suggestions spread through the file. Investigate the parsing and diagnostic behavior around those markers; done means syntax errors no longer produce broadly misleading diagnostics while genuine errors remain reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.