Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { Disposable } from 'vs/base/common/lifecycle';
import { RemoteAuthorities } from 'vs/base/common/network';
import { URI } from 'vs/base/common/uri';
import { IRemoteAuthorityResolverService, IRemoteConnectionData, ResolvedAuthority, ResolverResult } from 'vs/platform/remote/common/remoteAuthorityResolver';
import { Options } from 'vs/base/common/ipc';
import { getOptions } from 'vs/base/common/util';

export class RemoteAuthorityResolverService extends Disposable implements IRemoteAuthorityResolverService {

Expand Down Expand Up @@ -59,11 +61,14 @@ export class RemoteAuthorityResolverService extends Disposable implements IRemot

private _doResolveAuthority(authority: string): ResolverResult {
const connectionToken = this._connectionTokens.get(authority) || this._connectionToken;
// NOTE@coder: Add the proxy URI to the environment for use in the remote.
const options = getOptions<Options>();
const extensionHostEnv = { VSCODE_PROXY_URI: `${window.location.origin}${options.base}/proxy/{port}` };
if (authority.indexOf(':') >= 0) {
const pieces = authority.split(':');
return { authority: { authority, host: pieces[0], port: parseInt(pieces[1], 10), connectionToken } };
return { authority: { authority, host: pieces[0], port: parseInt(pieces[1], 10), connectionToken }, options: { extensionHostEnv } };
}
return { authority: { authority, host: authority, port: 80, connectionToken } };
return { authority: { authority, host: authority, port: 80, connectionToken }, options: { extensionHostEnv } };
}

_clearResolvedAuthority(authority: string): void {
Expand Down
1 change: 1 addition & 0 deletions src/vs/server/connection/extensionHostConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export class ExtensionHostConnection extends AbstractConnection {
debug: this.startParams.break ? undefined : portNumber,
args: ['--type=extensionHost', '--skipWorkspaceStorageLock'],
env: <ForkEnvironmentVariables>{
...(this.startParams.env || {}),
VSCODE_AMD_ENTRYPOINT: 'vs/workbench/services/extensions/node/extensionHostProcess',
VSCODE_PIPE_LOGGING: true,
VSCODE_VERBOSE_LOGGING: true,
Expand Down
6 changes: 3 additions & 3 deletions src/vs/server/ipc/terminalProviderIpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnec
};

// ptyHostService calls getEnvironment in the ptyHost process it creates,
// which uses that process's environment. The process spawned doesn't have
// VSCODE_IPC_HOOK_CLI in its env, so we add it here.
// which uses that process's environment, and adds some variables.
const getEnvironment = async (): Promise<platform.IProcessEnvironment> => {
const env = await this.ptyService.getEnvironment();
env.VSCODE_IPC_HOOK_CLI = process.env['VSCODE_IPC_HOOK_CLI']!;
env.VSCODE_IPC_HOOK_CLI = process.env.VSCODE_IPC_HOOK_CLI;
env.VSCODE_PROXY_URI = args.resolverEnv?.VSCODE_PROXY_URI || process.env.VSCODE_PROXY_URI;
return env;
};

Expand Down