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 is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

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