Rust analyzer is recommended but is still alpha, does not support general vscode workflows

How can we get automatic Cargo.toml discovery without any per-Cargo.toml intervention? i.e. suppose you pathologically create dozens of "cargo new mytest_xxx" in your bigger-than-just-rust vscode working directory.

Maybe this already solved but it seems like there is a lot of noise when searching for it and all the threads on here than come up in search seem to be closed already. See

If this is not solved in a way that is planned to be default, the recommended extension should be reverted to the old one which seemed to work.

I agree that RA should auto discover Cargo.toml. I'm getting this problem as well.

I disagree the recommended extension should be reverted. RLS is just horrible compared to RA.

Consider make a pull request to RA?

Rust-analyzer does auto discover Cargo.toml, but only up to one subdirectory deep.


My standard approach is to create a Cargo.toml file at the root of the repository and make my project a cargo workspace.

Assuming your repo has multiple projects in it where each project may contain a Rust crate, my Cargo.toml file would then look like this:

members = [

The nice thing about having a top-level Cargo.toml like this is that you can do cargo build or cargo run from anywhere within the repository (especially useful when using the cargo xtask pattern). It also simplifies CI because you can do cargo check --workspace && cargo test --workspace to compile+test all your Rust code, and the target/ folder is shared.

1 Like

It sounds like if one absolutely has to migrate to the new extension (avoid/defer for now if possible) one should symlink to top level entry point. A better option would be to increase depth of search somehow.

Yes, it sounds like there is some depth search feature that maybe can be hacked.