Fix: rust-analyzer failed to discover workspace [Visual Studio Code]



rust-analyzer failed to discover workspace


While trying to work on a Rust Project in Visual Studio Code (VSCode) IDE you get the error "rust-analyzer failed to discover workspace" then this could be because of the below few reasons.


Fix/Solution

- Make sure that the Cargo.toml is present in the root folder of your Rust project.

Make sure Cargo.toml file is there in the Root Folder

If you moved it somewhere, then make sure to get it back.

If you can't find it then you can run the cargo init in the terminal to generate the file.

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!