rust-lang / rust-lang/rust-analyzer
Don't auto import items when one is already in scope
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
I'm not sure if this was a client error (neovim) or a r-a error, but there are times where I import another item.
use ratatui::layout::Layout;
fn f () {
let layout = Lay [completions show, press enter]
}
use ratatui::layout::Layout;
use std::alloc::Layout; // ???
fn f () {
let layout = Lay [press enter]
}
I don't know if I was just too fast and the completion for alloc's Layout got completed faster than the one in scope maybe? I tried again and I can't replicate it.
(I'm 100% sure I didn't mistakinly press the arrow keys to select another one)
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 by reproducing the completion behavior described in the Rust and Neovim snippets, checking whether an item already in scope can trigger an incorrect auto-import. Compare the client interaction and completion choice, then verify that accepting the in-scope item no longer adds an unrelated import.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- neovim, rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100