diff --git a/src/vs/workbench/contrib/terminal/common/remote/remoteTerminalChannel.ts b/src/vs/workbench/contrib/terminal/common/remote/remoteTerminalChannel.ts index 6b6e849e344..6cdd98743ab 100644 --- a/src/vs/workbench/contrib/terminal/common/remote/remoteTerminalChannel.ts +++ b/src/vs/workbench/contrib/terminal/common/remote/remoteTerminalChannel.ts @@ -8,6 +8,7 @@ import { URI, UriComponents } from '../../../../../base/common/uri.js'; import { IChannel } from '../../../../../base/parts/ipc/common/ipc.js'; import { IWorkbenchConfigurationService } from '../../../../services/configuration/common/configuration.js'; import { IRemoteAuthorityResolverService } from '../../../../../platform/remote/common/remoteAuthorityResolver.js'; +import { IWorkbenchEnvironmentService } from '../../../../services/environment/common/environmentService.js'; import { IWorkspaceContextService } from '../../../../../platform/workspace/common/workspace.js'; import { serializeEnvironmentDescriptionMap, serializeEnvironmentVariableCollection } from '../../../../../platform/terminal/common/environmentVariableShared.js'; import { IConfigurationResolverService } from '../../../../services/configurationResolver/common/configurationResolver.js'; @@ -111,6 +112,7 @@ export class RemoteTerminalChannelClient implements IPtyHostController { @ITerminalLogService private readonly _logService: ITerminalLogService, @IEditorService private readonly _editorService: IEditorService, @ILabelService private readonly _labelService: ILabelService, + @IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService, ) { } restartPtyHost(): Promise { @@ -152,7 +154,13 @@ export class RemoteTerminalChannelClient implements IPtyHostController { } const resolverResult = await this._remoteAuthorityResolverService.resolveAuthority(this._remoteAuthority); - const resolverEnv = resolverResult.options && resolverResult.options.extensionHostEnv; + const resolverEnv = { + /** + * If the extension host was spawned via a launch configuration, + * include the environment provided by that launch configuration. + */ + ...(this._environmentService.debugExtensionHost.env ?? {}), ...resolverResult.options?.extensionHostEnv + }; const workspace = this._workspaceContextService.getWorkspace(); const workspaceFolders = workspace.folders; diff --git a/src/vs/workbench/services/environment/browser/environmentService.ts b/src/vs/workbench/services/environment/browser/environmentService.ts index d0bc952a874..e8d460f7967 100644 --- a/src/vs/workbench/services/environment/browser/environmentService.ts +++ b/src/vs/workbench/services/environment/browser/environmentService.ts @@ -322,6 +322,13 @@ export class BrowserWorkbenchEnvironmentService implements IBrowserWorkbenchEnvi case 'inspect-extensions': extensionHostDebugEnvironment.params.port = parseInt(value); break; + case 'extensionEnvironment': + try { + extensionHostDebugEnvironment.params.env = JSON.parse(value); + } catch (error) { + onUnexpectedError(error); + } + break; case 'enableProposedApi': extensionHostDebugEnvironment.extensionEnabledProposedApi = []; break;