rust-lang / rust-lang/rust-analyzer
Better handling of completions that shadow in scope entities
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
So to clarify, I would see the following possible action items:
detect when a trait autoimport would shadow an inherent method and downrank those completions
detect when a trait autoimport would shadow an inherent method and instead complete a fully qualified method call (e.g.
foo.borrow_<|>->std::borrow::BorrowMut::borrow_mut(foo))detect when there's an inherent method currently shadowed by a trait method, and complete the fully qualified method call instead (e.g. when there's
use std::borrow::BorrowMut;already, provideRefCell::borrow_mut(foo)as a completion)when using the UFCS -> method call assist, detect if the method call would be shadowed and remove e.g. the BorrowMut import automatically (maybe only if it's unused)
Originally posted by flodiebold in #13786
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
Begin with the four proposed action items and the linked discussion in rust-analyzer issue #13786. Investigate the completion and UFCS method-call assist behavior around trait autoimports, inherent methods, shadowing, and fully qualified calls. Done should mean the agreed shadowing cases are handled consistently, with coverage for the examples described here.
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
- Needs clarification
- Newbie friendliness
- 25/100