Skip to content

Commit 1461c7d

Browse files
committed
Finalize EnvironmentVariableMutatorOptions API
Fixes #179476
1 parent 8a150ec commit 1461c7d

File tree

5 files changed

+31
-70
lines changed

5 files changed

+31
-70
lines changed

extensions/vscode-api-tests/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@
5252
"telemetry",
5353
"windowActivity",
5454
"interactiveUserActions",
55-
"envCollectionWorkspace",
56-
"envCollectionOptions"
55+
"envCollectionWorkspace"
5756
],
5857
"private": true,
5958
"activationEvents": [],

src/vs/workbench/api/common/extHostTerminalService.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -944,23 +944,14 @@ class UnifiedEnvironmentVariableCollection {
944944
}
945945

946946
replace(variable: string, value: string, options: vscode.EnvironmentVariableMutatorOptions | undefined, scope: vscode.EnvironmentVariableScope | undefined): void {
947-
if (this._extension && options) {
948-
checkProposedApiEnabled(this._extension, 'envCollectionOptions');
949-
}
950947
this._setIfDiffers(variable, { value, type: EnvironmentVariableMutatorType.Replace, options: options ?? { applyAtProcessCreation: true }, scope });
951948
}
952949

953950
append(variable: string, value: string, options: vscode.EnvironmentVariableMutatorOptions | undefined, scope: vscode.EnvironmentVariableScope | undefined): void {
954-
if (this._extension && options) {
955-
checkProposedApiEnabled(this._extension, 'envCollectionOptions');
956-
}
957951
this._setIfDiffers(variable, { value, type: EnvironmentVariableMutatorType.Append, options: options ?? { applyAtProcessCreation: true }, scope });
958952
}
959953

960954
prepend(variable: string, value: string, options: vscode.EnvironmentVariableMutatorOptions | undefined, scope: vscode.EnvironmentVariableScope | undefined): void {
961-
if (this._extension && options) {
962-
checkProposedApiEnabled(this._extension, 'envCollectionOptions');
963-
}
964955
this._setIfDiffers(variable, { value, type: EnvironmentVariableMutatorType.Prepend, options: options ?? { applyAtProcessCreation: true }, scope });
965956
}
966957

src/vs/workbench/services/extensions/common/extensionsApiProposals.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export const allApiProposals = Object.freeze({
4040
dropMetadata: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.dropMetadata.d.ts',
4141
editSessionIdentityProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts',
4242
editorInsets: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editorInsets.d.ts',
43-
envCollectionOptions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.envCollectionOptions.d.ts',
4443
envCollectionWorkspace: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.envCollectionWorkspace.d.ts',
4544
envShellEvent: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.envShellEvent.d.ts',
4645
extensionRuntime: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionRuntime.d.ts',

src/vscode-dts/vscode.d.ts

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11334,6 +11334,22 @@ declare module 'vscode' {
1133411334
Prepend = 3
1133511335
}
1133611336

11337+
/**
11338+
* Options applied to the mutator.
11339+
*/
11340+
export interface EnvironmentVariableMutatorOptions {
11341+
/**
11342+
* Apply to the environment just before the process is created.
11343+
*/
11344+
applyAtProcessCreation?: boolean;
11345+
11346+
/**
11347+
* Apply to the environment in the shell integration script. Note that this _will not_ apply
11348+
* the mutator if shell integration is disabled or not working for some reason.
11349+
*/
11350+
applyAtShellIntegration?: boolean;
11351+
}
11352+
1133711353
/**
1133811354
* A type of mutation and its value to be applied to an environment variable.
1133911355
*/
@@ -11347,6 +11363,11 @@ declare module 'vscode' {
1134711363
* The value to use for the variable.
1134811364
*/
1134911365
readonly value: string;
11366+
11367+
/**
11368+
* Options applied to the mutator.
11369+
*/
11370+
readonly options: EnvironmentVariableMutatorOptions;
1135011371
}
1135111372

1135211373
/**
@@ -11376,8 +11397,10 @@ declare module 'vscode' {
1137611397
*
1137711398
* @param variable The variable to replace.
1137811399
* @param value The value to replace the variable with.
11400+
* @param options Options applied to the mutator, when no options are provided this will
11401+
* default to `{ applyAtProcessCreation: true }`.
1137911402
*/
11380-
replace(variable: string, value: string): void;
11403+
replace(variable: string, value: string, options?: EnvironmentVariableMutatorOptions): void;
1138111404

1138211405
/**
1138311406
* Append a value to an environment variable.
@@ -11387,8 +11410,10 @@ declare module 'vscode' {
1138711410
*
1138811411
* @param variable The variable to append to.
1138911412
* @param value The value to append to the variable.
11413+
* @param options Options applied to the mutator, when no options are provided this will
11414+
* default to `{ applyAtProcessCreation: true }`.
1139011415
*/
11391-
append(variable: string, value: string): void;
11416+
append(variable: string, value: string, options?: EnvironmentVariableMutatorOptions): void;
1139211417

1139311418
/**
1139411419
* Prepend a value to an environment variable.
@@ -11398,8 +11423,10 @@ declare module 'vscode' {
1139811423
*
1139911424
* @param variable The variable to prepend.
1140011425
* @param value The value to prepend to the variable.
11426+
* @param options Options applied to the mutator, when no options are provided this will
11427+
* default to `{ applyAtProcessCreation: true }`.
1140111428
*/
11402-
prepend(variable: string, value: string): void;
11429+
prepend(variable: string, value: string, options?: EnvironmentVariableMutatorOptions): void;
1140311430

1140411431
/**
1140511432
* Gets the mutator that this collection applies to a variable, if any.

src/vscode-dts/vscode.proposed.envCollectionOptions.d.ts

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)