rust-lang / vscode-rust

Rust extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=rust-lang.rust
Other
1.39k stars 167 forks source link

HTTP proxy problem in Linux Desktop #661

Open izderadicka opened 4 years ago

izderadicka commented 4 years ago

Hi I have Ubuntu desktop with Unity/Gnome and automatic proxy detection. Automatic proxy detection seem to work fine in VS Code, some Extensions work with proxy (like crates), RLS has problem - when I add new dependency to cargo.toml rls runs for a long time and then ends with this error:

failed to load source for a dependency on `bincode`
Unable to update registry `https://github.com/rust-lang/crates.io-index`
failed to fetch `https://github.com/rust-lang/crates.io-index`
failed to connect to github.com: No route to host; class=Os (2)

Fix is to run cargo build manually in terminal proper http_proxy and https_proxy env. variables. Look like the proxy detected in VS Code is not propagated to environment of RLS, when it is started?

izderadicka commented 4 years ago

When code is started with http_proxy and https_proxy env. variables, then rls is OK, it's just in case when Desktop is setup for automatic proxy detection - chrome detects proxy OK I think but this proxy is not then passed to environment where rls is running.

ghost commented 4 years ago

I have the same problem, do you have a solution now :)

stefan-muc commented 3 years ago

I have what I guess is the same problem on Windows: After starting VSCode and waiting some time (until after some minutes rls finally is up) I find those logs in Rust Language Server output:

[2021-03-16T14:50:25Z ERROR rls::actions] failed to fetch project model, using fallback: failed to download from `https://crates.io/api/v1/crates/winapi-i686-pc-windows-gnu/0.4.0/download`
[2021-03-16T14:51:57Z ERROR rls::actions] failed to fetch project model, using fallback: failed to download from `https://crates.io/api/v1/crates/winapi-i686-pc-windows-gnu/0.4.0/download`
[2021-03-16T15:03:08Z ERROR rls::actions] failed to fetch project model, using fallback: failed to download from `https://crates.io/api/v1/crates/winapi-i686-pc-windows-gnu/0.4.0/download`

I have Windows environment variable https_proxy set to http://x.x.x.x:yyyy and VSCode settings tell me: image So this should be propagated to VSCode - but is it?

Manual cargo build in Windows PowerShell works perfectly (including downloading necessary crates) so this is not an issue of my proxy, but rather VSCode or vscode-rust extension

Maybe related - I experience those too: https://github.com/rust-lang/rls/issues/1620 https://github.com/rust-lang/vscode-rust/issues/425