rust-lang / rust-lang/rust-analyzer
Assists that should really be diagnostics quickfix
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
We have a few assists that actually take the role of quickfixes of diagnostics, but haven't been implemented as such because of simplicity or due to us not having the diagnostic infra for it yet. We should make an effort into implementing the corresponding diagnostics and transitioning them towards becoming quickfixes for said diagnostics where applicable.
The following assists should be turned into quickfixes for diagnostics (fully or partially):
- add_lifetime_to_type
- diagnostic implemented
- add_impl_missing_members
- diagnostic implemented
- Note that only
add_impl_missing_membersis a diagnostic quickfix,add_impl_default_memberswill remain an assist
- add_missing_match_arms
- diagnostic implemented, https://github.com/rust-analyzer/rust-analyzer/blob/e6ba791dcecfb2d69e831e204f06f2d3bf86323a/crates/ide-diagnostics/src/handlers/missing_match_arms.rs
- Probably somewhat blocked on us improving our exhaustiveness checking. We also want to retain the ability to explode
_patterns in matches
- add_return_type
- diagnostic implemented
- Note that we want to retain the assist for closure return types as eliding them can be valid, yet sometimes we want to be able to explicitly annotate them
- add_turbo_fish
- diagnostic implemented
- turbo fishes can be elided in some occasions, so we want to also keep the assist for it
- auto_import
- diagnostics implemented, this one is tough as unresolved names have many forms, so this will consist of a lot of different diagnostics
- There is at least on occurence where no diagnostic will exist, yet the assist would be wanted, identifier patterns. Those don't usually generate diagnostics but could be part of a path or signal an unimported constant.
- convert_into_to_from
- diagnostic implemented, should be a warning
- fix_visibility
- diagnostic implemented, like auto import, can have multiple sources
- generate_constant
- diagnostic implemented
- generate_function
- unresolved function diagnostic implemented
- unresolved method diagnostic implemented, https://github.com/veykril/rust-analyzer/blob/e6ba791dcecfb2d69e831e204f06f2d3bf86323a/crates/ide-diagnostics/src/handlers/unresolved_method.rs#L19
- remove_unused_param
- diagnostic implemented
- unnecessary_async
- diagnostic implemented
The assist checkbox is for when the assist code has been turned into the diagnostics quickfix
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 with the listed handlers under crates/ide-assists/src/handlers and compare them with the implemented diagnostics in crates/ide-diagnostics/src/handlers/missing_match_arms.rs and unresolved_method.rs. Work through the checklist, preserving assists where the issue notes they remain useful, and consider each item done when its applicable diagnostic quickfix is implemented and the checklist can be updated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience, devtools, tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100