rust-lang / rust-lang/rust-analyzer
Enhancement request: Priorize auto-import completions over full paths (possibly configurable?)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Hi, I've looked around and couldn't find any issues that describe this exactly, so I hope this isn't a duplicate. I found some related issues (#15453, #13953 seems to basically be asking for the opposite, so maybe a configuration option makes sense).
R-a currently uses function parameter types to prioritize completions, which is great! I think this was first implemented for #15384 although the related screenshot https://github.com/rust-lang/rust-analyzer/pull/15627#issuecomment-1849605190 seems to show the behavior I am asking for, so maybe something has changed since then?
However, it provides completions with full paths (at least for enums) which can be kind of ugly for deeply nested paths; adding part of the enum name allows "standard" completion to kick in and suggest an auto-import, but it's still prioritized lower then the full paths, which can be hard to get to for enums with many members. For example:
Is there any way to configure r-a so that Foo (use self::contains_enum::Foo) comes first in the suggestion list? If not, could this be added as a configurable option so that folks looking for things like #13953 can retain the current behavior if they would rather use full paths?
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
No source file or test is identified in the issue. Start by examining rust-analyzer's completion prioritization and the related issues #15384, #15453, and #13953; done means auto-import completions can be ranked ahead of full-path completions, with the requested configurability clarified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100