Change:
For example: Context:
As we anticipate we might need shell scoping as well in the future, use something similar to instead. Updated proposal: One issue with this is that carries optional properties. Hence an alternative could be:
The required would need to be removed when we a second one anyway, we can just treat and the same as
Sorry what do you mean by the "second one"? Mostly I was trying to follow : But I guess we don't have to strictly follow it?
by a second one I mean a second scope, we don't want the user to explicitly enumerate all the scopes to set it which would do.
Updated proposal:
Closing in favor of as these issues were only open to finalize proposed API.
Moving this out of June as it's a feature request.
I was expecting this so it's easier to understand for an API user:
That's what I had initially had , you're the one who recommended that perhaps we should put it inside itself:
API sync also seemed to be in agreement with that, but maybe we should check again.
my mistake, I forgot some of the conversations as this has gone through a few iterations
Based on discussion in API sync, we should probably deprecate existing API and merge it with the scoped one (similar to )
Assigning myself too so it's easier for me to track
When viewing contributions, is it possible to open the preview of the markdown directly instead of the file? ! as opposed to ! I can open preview using: !
since this is an advanced feature I think the raw markdown is more flexible as the user can navigate and copy section of it better. So I don't think this is a necessary change personally
Feedback before finalization: Add an interface implements Add to the Clarify how scoped interacts with the non-scoped collection Don't deprecate
Should we also call out how it's applied in addition to (and after) the global collection? Looks good otherwise
Sure, I have modified the docstrings to append it I plan to have the implementation ready but only merge and adopt it in Python extension next week to avoid multiple iterations.

Discussion:
"telemetry", "windowActivity", "interactiveUserActions", <del> "envCollectionWorkspace", </del> "envCollectionOptions" ], "private": true,

*--------------------------------------------------------------------------------------------*/ import { deepStrictEqual, doesNotThrow, equal, ok, strictEqual, throws } from 'assert'; <del> import { commands, ConfigurationTarget, Disposable, env, EnvironmentVariableMutator, EnvironmentVariableMutatorOptions, EnvironmentVariableMutatorType, EventEmitter, ExtensionContext, extensions, ExtensionTerminalOptions, GlobalEnvironmentVariableCollection, Pseudoterminal, Terminal, TerminalDimensions, TerminalExitReason, TerminalOptions, TerminalState, UIKind, Uri, window, workspace } from 'vscode'; </del> <ins> import { commands, ConfigurationTarget, Disposable, env, EnvironmentVariableMutator, EnvironmentVariableMutatorOptions, EnvironmentVariableMutatorType, EventEmitter, ExtensionContext, extensions, ExtensionTerminalOptions, Pseudoterminal, Terminal, TerminalDimensions, TerminalExitReason, TerminalOptions, TerminalState, UIKind, Uri, window, workspace } from 'vscode'; </ins> import { assertNoRpc, poll } from '../utils'; // Disable terminal tests:

}); test('get and forEach should work (scope)', () => { <del> // TODO: Remove cast once `envCollectionWorkspace` API is finalized. const collection = extensionContext.environmentVariableCollection as GlobalEnvironmentVariableCollection; </del> <ins> const collection = extensionContext.environmentVariableCollection; </ins> disposables.push({ dispose: () => collection.clear() }); const scope = { workspaceFolder: { uri: Uri.file('workspace1'), name: 'workspace1', index: 0 } }; const scopedCollection = collection.getScoped(scope);

} getScopedEnvironmentVariableCollection(scope: vscode.EnvironmentVariableScope | undefined): IEnvironmentVariableCollection { <del> if (this._extension && scope) { // TODO: This should be removed when the env var extension API(s) are stabilized checkProposedApiEnabled(this._extension, 'envCollectionWorkspace'); } </del> const scopedCollectionKey = this.getScopeKey(scope); let scopedCollection = this.scopedCollections.get(scopedCollectionKey); if (!scopedCollection) {

editSessionIdentityProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts', editorInsets: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.editorInsets.d.ts', envCollectionOptions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.envCollectionOptions.d.ts', <del> envCollectionWorkspace: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.envCollectionWorkspace.d.ts', </del> envShellEvent: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.envShellEvent.d.ts', extensionRuntime: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionRuntime.d.ts', extensionsAny: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.extensionsAny.d.ts',

readonly extensionPath: string; /** <del> * Gets the extension's environment variable collection for this workspace, enabling changes * to be applied to terminal environment variables. </del> <ins> * Gets the extension's global environment variable collection for this workspace, enabling changes to be * applied to terminal environment variables. </ins> */ <del> readonly environmentVariableCollection: EnvironmentVariableCollection; </del> <ins> readonly environmentVariableCollection: GlobalEnvironmentVariableCollection; </ins> /** * Get the absolute path of a resource contained in the extension.

clear(): void; } <ins> export interface GlobalEnvironmentVariableCollection extends EnvironmentVariableCollection { /** * Gets scope-specific environment variable collection for the extension. This enables alterations to * terminal environment variables solely within the designated scope, and is applied in addition to (and * after) the global collection. * * Each object obtained through this method is isolated and does not impact objects for other scopes, * including the global collection. * * @param scope The scope to which the environment variable collection applies to. * * If a scope parameter is omitted, collection applicable to all relevant scopes for that parameter is * returned. For instance, if the 'workspaceFolder' parameter is not specified, the collection that applies * across all workspace folders will be returned. */ getScoped(scope: EnvironmentVariableScope): EnvironmentVariableCollection; } export type EnvironmentVariableScope = { /** * Any specific workspace folder to get collection for. */ workspaceFolder?: WorkspaceFolder; }; </ins> /** * A location in the editor at which progress information can be shown. It depends on the * location how progress is visually represented.

<del> /*--------------------------------------------------------------------------------------------- *  Copyright (c) Microsoft Corporation. All rights reserved. *  Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ declare module 'vscode' { // https://github.com/microsoft/vscode/issues/171173 // export interface ExtensionContext { // 	/** // 	 * Gets the extension's global environment variable collection for this workspace, enabling changes to be // 	 * applied to terminal environment variables. // 	 */ // 	readonly environmentVariableCollection: GlobalEnvironmentVariableCollection; // } export interface GlobalEnvironmentVariableCollection extends EnvironmentVariableCollection { /** * Gets scope-specific environment variable collection for the extension. This enables alterations to * terminal environment variables solely within the designated scope, and is applied in addition to (and * after) the global collection. * * Each object obtained through this method is isolated and does not impact objects for other scopes, * including the global collection. * * @param scope The scope to which the environment variable collection applies to. * * If a scope parameter is omitted, collection applicable to all relevant scopes for that parameter is * returned. For instance, if the 'workspaceFolder' parameter is not specified, the collection that applies * across all workspace folders will be returned. */ getScoped(scope: EnvironmentVariableScope): EnvironmentVariableCollection; } export type EnvironmentVariableScope = { /** * Any specific workspace folder to get collection for. If unspecified, collection applicable to all workspace folders is returned. */ workspaceFolder?: WorkspaceFolder; }; } </del>