diff --git a/src/vs/workbench/api/common/extHostTerminalService.ts b/src/vs/workbench/api/common/extHostTerminalService.ts index d91e8fe990fb1..371eace01f7c8 100644 --- a/src/vs/workbench/api/common/extHostTerminalService.ts +++ b/src/vs/workbench/api/common/extHostTerminalService.ts @@ -965,22 +965,25 @@ class UnifiedEnvironmentVariableCollection { } const key = this.getKey(variable, mutator.scope); const current = this.map.get(key); + const newOptions = mutator.options ? { + applyAtProcessCreation: mutator.options.applyAtProcessCreation ?? false, + applyAtShellIntegration: mutator.options.applyAtShellIntegration ?? false, + } : { + applyAtProcessCreation: true + }; if ( !current || current.value !== mutator.value || current.type !== mutator.type || - current.options?.applyAtProcessCreation !== (mutator.options.applyAtProcessCreation ?? true) || - current.options?.applyAtShellIntegration !== (mutator.options.applyAtShellIntegration ?? false) || + current.options?.applyAtProcessCreation !== newOptions.applyAtProcessCreation || + current.options?.applyAtShellIntegration !== newOptions.applyAtShellIntegration || current.scope?.workspaceFolder?.index !== mutator.scope?.workspaceFolder?.index ) { const key = this.getKey(variable, mutator.scope); const value: IEnvironmentVariableMutator = { variable, ...mutator, - options: { - applyAtProcessCreation: mutator.options.applyAtProcessCreation ?? true, - applyAtShellIntegration: mutator.options.applyAtShellIntegration ?? false, - } + options: newOptions }; this.map.set(key, value); this._onDidChangeCollection.fire(); diff --git a/src/vscode-dts/vscode.proposed.envCollectionOptions.d.ts b/src/vscode-dts/vscode.proposed.envCollectionOptions.d.ts index d25a92725a4dd..9a854922a2d3f 100644 --- a/src/vscode-dts/vscode.proposed.envCollectionOptions.d.ts +++ b/src/vscode-dts/vscode.proposed.envCollectionOptions.d.ts @@ -13,16 +13,12 @@ declare module 'vscode' { export interface EnvironmentVariableMutatorOptions { /** * Apply to the environment just before the process is created. - * - * Defaults to true. */ applyAtProcessCreation?: boolean; /** * Apply to the environment in the shell integration script. Note that this _will not_ apply * the mutator if shell integration is disabled or not working for some reason. - * - * Defaults to false. */ applyAtShellIntegration?: boolean; } @@ -32,24 +28,27 @@ declare module 'vscode' { */ export interface EnvironmentVariableMutator { /** - * Options applied to the mutator. + * Options applied to the mutator */ readonly options: EnvironmentVariableMutatorOptions; } export interface EnvironmentVariableCollection extends Iterable<[variable: string, mutator: EnvironmentVariableMutator]> { /** - * @param options Options applied to the mutator. + * @param options Options applied to the mutator, when not options are provided this will + * default to `{ applyAtProcessCreation: true }` */ replace(variable: string, value: string, options?: EnvironmentVariableMutatorOptions): void; /** - * @param options Options applied to the mutator. + * @param options Options applied to the mutator, when not options are provided this will + * default to `{ applyAtProcessCreation: true }` */ append(variable: string, value: string, options?: EnvironmentVariableMutatorOptions): void; /** - * @param options Options applied to the mutator. + * @param options Options applied to the mutator, when not options are provided this will + * default to `{ applyAtProcessCreation: true }` */ prepend(variable: string, value: string, options?: EnvironmentVariableMutatorOptions): void; }