Skip to content

Commit b970419

Browse files
committed
Last round of review
1 parent ad86f9a commit b970419

2 files changed

Lines changed: 20 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
from published versions since it shows up in the VS Code extension changelog
66
tab and is confusing to users. Add it back between releases if needed. -->
77

8+
## Unreleased
9+
10+
### Fixed
11+
12+
- Propagate VS Code's proxy settings (`http.proxy`, `http.noProxy`, and
13+
`coder.proxyBypass`) to the SSH environment as `HTTP_PROXY`/`HTTPS_PROXY`/
14+
`NO_PROXY`, so the `coder ssh` ProxyCommand connects through the configured
15+
proxy whether SSH runs as a child process or in a terminal.
16+
817
## [v1.15.0](https://github.com/coder/vscode-coder/releases/tag/v1.15.0) 2026-06-12
918

1019
### Added

src/remote/environment.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type {
66
} from "vscode";
77

88
type Environment = Record<string, string | undefined>;
9-
type PreviousValue = [key: string, existed: boolean, value: string | undefined];
109
type SshEnvironment = Partial<
1110
Record<"HTTP_PROXY" | "HTTPS_PROXY" | "NO_PROXY", string>
1211
>;
@@ -62,10 +61,7 @@ export function applySshEnvironment(
6261
};
6362
}
6463

65-
/**
66-
* The proxy portion of the SSH environment. Exposed so callers can check whether
67-
* proxy settings are configured via `.HTTP_PROXY`.
68-
*/
64+
/** The proxy portion of the SSH environment, derived from VS Code's settings. */
6965
export function getSshProxyEnvironment(
7066
cfg: Pick<WorkspaceConfiguration, "get">,
7167
): SshEnvironment {
@@ -75,22 +71,23 @@ export function getSshProxyEnvironment(
7571
joinNoProxy(cfg.get<string[]>("http.noProxy"));
7672

7773
return {
78-
...(httpProxy ? { HTTP_PROXY: httpProxy, HTTPS_PROXY: httpProxy } : {}),
79-
...(noProxy ? { NO_PROXY: noProxy } : {}),
74+
HTTP_PROXY: httpProxy,
75+
HTTPS_PROXY: httpProxy,
76+
NO_PROXY: noProxy,
8077
};
8178
}
8279

8380
function applyEnvironment(
8481
values: SshEnvironment,
8582
env: Environment,
8683
): { dispose(): void } {
87-
const previous: PreviousValue[] = [];
84+
// Stored `undefined` means the key was absent and should be deleted on cleanup.
85+
const previous: Environment = {};
8886
for (const [key, value] of Object.entries(values)) {
8987
if (value === undefined) {
9088
continue;
9189
}
92-
const previousValue = env[key];
93-
previous.push([key, previousValue !== undefined, previousValue]);
90+
previous[key] = env[key];
9491
env[key] = value;
9592
}
9693

@@ -101,11 +98,11 @@ function applyEnvironment(
10198
return;
10299
}
103100
disposed = true;
104-
for (const [key, existed, value] of previous) {
105-
if (existed) {
106-
env[key] = value;
107-
} else {
101+
for (const [key, value] of Object.entries(previous)) {
102+
if (value === undefined) {
108103
delete env[key];
104+
} else {
105+
env[key] = value;
109106
}
110107
}
111108
},

0 commit comments

Comments
 (0)