Rust analyzer not working behind firewall

Hello, after spending enough time searching came here for help. I am behind firewall and cannot connect to internet via vscode. I can however browse web. Is there a way I can configure rust_analyzer ? Right now it show ‘unable to load workspace’

Thank you

rust-analyzer itself doesn't require internet connection, but it will ask cargo for metadata when loading a workspace, and cargo by default will need to download crates indices from the registry server.

can you build the crate successfully by running cargo build? if so, I guess you have special configuration for cargo (e.g. proxy, or locally mirrored registry, etc), but somehow you forget to apply the same configuration when running through rust-analyzer.

I don't know exactly how your environment is setup, but as long as you can run cargo build or cargo check manually, you just need to let rust-analyzer use the same configuration. these rust-analyzer settings might be interesting:

rust-analyzer.cargo.extraArgs

Extra arguments that are passed to every cargo invocation.

rust-analyzer.cargo.extraEnv

Extra environment variables that will be set when running cargo, rustc or other commands within the workspace. Useful for setting RUSTFLAGS.

1 Like

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.