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.

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap