rust-lang / rust-lang/rust-analyzer

adding dependencies sometimes breaks completions

Open
#9,584 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I've been using rust-analyzer through VSCode and I keep encountering situations where adding a dependency causes some completions to stop working. I've attached the smallest example I could find, where completing the word "info" in main.rs should suggest log::info, and it does if either x11 or clap is removed from the dependencies, but with both dependencies in place, the only suggestions are std::panic::PanicInfo and a bunch of types from x11 whose names end in Info. Although this example involves a macro, I've seen the same issue with method names as well.

I'm using the following versions:

VSCode: 1.58.0 2d23c42a936db1c7b3b06f918cde29561cc47cd6
rust-analyzer extension: 0.2.662
rust-analyzer e5c1c8cf2 2021-07-05 stable
cargo 1.52.0 (69767412a 2021-04-21)
rustc 1.52.1 (9bc8c42bb 2021-05-09)

example.tar.gz

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

Unpack example.tar.gz and reproduce completion in main.rs with both x11 and clap dependencies present, then compare it with each dependency removed. Check why completing "info" omits log::info and verify that the expected macro and method completions return without introducing the unrelated x11 or PanicInfo suggestions.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.