rust-lang / rust-lang/rust-analyzer

Workspace does not automatically reload when a package is added to a workspace crate

Open
#16,683 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

rust-analyzer version: rust-analyzer version: 0.3.1860-standalone (5346002d0 2024-02-25)

rustc version: rustc 1.78.0-nightly (6672c16af 2024-02-17)

relevant settings:

  • A cargo workspace with a root Cargo.toml file with only a workspace table and no direct code units.
  • A workspace setting with a glob; e.g.,
[workspace]
members = ["crates/*"]
resolver = "2"
  • A blank crate in crates directory (cargo new --vcs none --bin crates/test-bin)

steps to reproduce:

  • Open VS Code with a workspace project structure and glob members as described above.
  • Add a new package to a crate (cargo new -p test-bin clap)
  • Observe RA does not reload
  • Observe RA does not provide typeahead hints for clap.
  • Manually trigger "Reload Workspace"
  • Observe RA provides typeahead hints for clap.

The bug report for #16550 made me realize #10442 is likely related. RA should always check for Cargo.tomls represented by the workspace members regardless of how deep they are in the tree.

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 the issue in VS Code with a root Cargo.toml using workspace glob members and a crate under crates/, then add a package with cargo new -p test-bin clap. Start by tracing workspace reload and Cargo.toml discovery; done means rust-analyzer reloads automatically and provides typeahead hints for the new dependency without manually triggering Reload Workspace.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.