rust-lang / rust-lang/rust-analyzer
In `#[allow(...)]` completion, prefer lints that are firing
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
A common action (especially when using clippy) is to observe reported lint and #[allow()] it. Therefore, it would be useful if, when completing with the cursor is inside an #[allow()], the ranking preferred the names of lints for which at least one diagnostic has been emitted within the syntax tree to which the #[allow()] attribute applies.
It probably makes sense to generalize this to any combination of attribute and diagnostic severity.
allowandexpectwould prefer current warnings and errorsdenyandforbidwould prefer current warningswarnwould prefer current errors
I took a look at implementing this, but I didn't find a way to fetch info about current diagnostics from inside ide_completion::completions::attribute::complete_known_attribute_input.
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 at ide_completion::completions::attribute::complete_known_attribute_input and investigate how diagnostics for the attribute's syntax tree could be made available there. Define the severity-to-attribute mapping described in the issue, then verify that lint completion ranking prefers currently emitted diagnostics for allow, expect, deny, forbid, and warn.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100