Help with Rust-Analyzer

I'd like to start out with that I'm pretty new to Rust, and I tried to solved this issue myself and unfortunately after hours of searching and trying countless things I can't remember, I have decided to finally ask for help.

Right now one of my projects is using the rust-analyzer extension in VS Code. However, upon every save the rust-analyzer scans everything inside the .cargo/registry/src/ directory. Obviously this is not ideal and brings up 2k or more errors in VSCode's "Problems" tab near the terminal. Here is a screenshot below:
This results in extremely slow development, as I have to wait for rust-analyzer every single time I save, and with it scanning this much and showing over 2k errors, it's quite time consuming. Also, I am using, so I cannot do anything such as code and such.

I apologize if I'm missing anything here or this isn't an ideal topic, as this is my first time actually posting something here.

Edit: Solved, however I'd like to note that the .cargo directory is completely outside of the project directory, which was the most confusing part. My project is located in /workspace/<project_name> and cargo is in /workspace/.cargo.

If you search for "files.exclude" in the VSCode settings, you should be able to add the .cargo folder to that, and rust-analyzer should respect that and ignore the folder contents.

This may not help you with gitpod, but in a normal development environment, .cargo would be located in your home directory, not within the directory you have opened as a VS Code workspace.

If you can't change either $CARGO_HOME or where your code is, then of course you'll need to ignore the files.

Can you not use File > Open in the VS Code menu bar, to open a subdirectory as workspace? Or does Gitpod drop your project files in the same directory?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.