rust-lang / rust-lang/rust-analyzer

suggested completions should prefer already imported items over stdlib types behind a nightly flag that isn't even active

Open
#23,253 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-completion C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

if i have a type like StrId imported, and i type Str and then ctrl+space to see the suggestions, RA prefers to show the exact match Str, which is short for std::mem::type_info::Str, and my already-imported StrId goes second in the list.

The std::mem::type_info type is behind the type_info nightly flag, which isn't active in my project. I don't think that type should show up in my suggested completions at all when i don't have that nightly flag active, but if it somehow does then it should at least be sorted after all the items that are already imported.

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 completion for an imported StrId after typing Str and pressing Ctrl+Space in a project without the type_info nightly flag. Then trace completion handling for std::mem::type_info::Str; done means the inactive stdlib type is excluded, or at minimum appears after already-imported items.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.