Add basic proxy settings (#11852)

Adding `proxy` keyword to configure proxy while using zed. After setting
the proxy, restart Zed to acctually use the proxy.

Example setting: 
```rust
"proxy" = "socks5://localhost:10808"
"proxy" = "http://127.0.0.1:10809"
```

Closes #9424, closes #9422, closes #8650, closes #5032, closes #6701,
closes #11890

Release Notes:

- Added settings to configure proxy in Zed

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
This commit is contained in:
张小白 2024-05-17 00:43:26 +08:00 committed by GitHub
parent 90b631ff3e
commit 1b261608c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 110 additions and 20 deletions

View file

@ -266,8 +266,21 @@ impl NodeRuntime for RealNodeRuntime {
command.args(["--prefix".into(), directory.to_path_buf()]);
}
if let Some(proxy) = self.http.proxy() {
command.args(["--proxy", proxy]);
}
#[cfg(windows)]
command.creation_flags(windows::Win32::System::Threading::CREATE_NO_WINDOW.0);
{
// SYSTEMROOT is a critical environment variables for Windows.
if let Some(val) = std::env::var("SYSTEMROOT")
.context("Missing environment variable: SYSTEMROOT!")
.log_err()
{
command.env("SYSTEMROOT", val);
}
command.creation_flags(windows::Win32::System::Threading::CREATE_NO_WINDOW.0);
}
command.output().await.map_err(|e| anyhow!("{e}"))
};