diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 20331a51a87902d20299ab81206a6699fd5790b3..91868efb3efcb85433799546bb2d1f93eea5b2d1 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -488,7 +488,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I return extHostTerminalService.onDidWriteTerminalData(listener, thisArg, disposables); }, getEnvironmentVariableCollection(persistent?: boolean): vscode.EnvironmentVariableCollection { - return null!; + checkProposedApiEnabled(extension); + return extHostTerminalService.getEnvironmentVariableCollection(extension, persistent); }, get state() { return extHostWindow.state; @@ -955,6 +956,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I DocumentLink: extHostTypes.DocumentLink, DocumentSymbol: extHostTypes.DocumentSymbol, EndOfLine: extHostTypes.EndOfLine, + EnvironmentVariableMutatorType: extHostTypes.EnvironmentVariableMutatorType, EvaluatableExpression: extHostTypes.EvaluatableExpression, EventEmitter: Emitter, ExtensionKind: extHostTypes.ExtensionKind, diff --git a/src/vs/workbench/api/common/extHostTerminalService.ts b/src/vs/workbench/api/common/extHostTerminalService.ts index caf46e8a4ced660afe17a47c264d8e0197c69691..b332a4e5cde91f315b49405d01b54d430e1c6aa9 100644 --- a/src/vs/workbench/api/common/extHostTerminalService.ts +++ b/src/vs/workbench/api/common/extHostTerminalService.ts @@ -15,6 +15,7 @@ import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; import { TerminalDataBufferer } from 'vs/workbench/contrib/terminal/common/terminalDataBuffering'; import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle'; import { Disposable as VSCodeDisposable } from './extHostTypes'; +import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; export interface IExtHostTerminalService extends ExtHostTerminalServiceShape { @@ -35,7 +36,8 @@ export interface IExtHostTerminalService extends ExtHostTerminalServiceShape { attachPtyToTerminal(id: number, pty: vscode.Pseudoterminal): void; getDefaultShell(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string; getDefaultShellArgs(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string[] | string; - registerLinkHandler(handler: vscode.TerminalLinkHandler): vscode.Disposable + registerLinkHandler(handler: vscode.TerminalLinkHandler): vscode.Disposable; + getEnvironmentVariableCollection(extension: IExtensionDescription, persistent?: boolean): vscode.EnvironmentVariableCollection; } export const IExtHostTerminalService = createDecorator('IExtHostTerminalService'); @@ -333,6 +335,7 @@ export abstract class BaseExtHostTerminalService implements IExtHostTerminalServ public abstract $getAvailableShells(): Promise; public abstract $getDefaultShellAndArgs(useAutomationShell: boolean): Promise; public abstract $acceptWorkspacePermissionsChanged(isAllowed: boolean): void; + public abstract getEnvironmentVariableCollection(extension: IExtensionDescription, persistent?: boolean): vscode.EnvironmentVariableCollection; public createExtensionTerminal(options: vscode.ExtensionTerminalOptions): vscode.Terminal { const terminal = new ExtHostTerminal(this._proxy, options, options.name); @@ -669,4 +672,8 @@ export class WorkerExtHostTerminalService extends BaseExtHostTerminalService { public $acceptWorkspacePermissionsChanged(isAllowed: boolean): void { // No-op for web worker ext host as workspace permissions aren't used } + + public getEnvironmentVariableCollection(extension: IExtensionDescription, persistent?: boolean): vscode.EnvironmentVariableCollection { + throw new Error('Not implemented'); + } } diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index 7ce3ecf2590ac802e14db83e214c6346245f0a12..1c40cf37ffb24c33ea2eb81c65fb89eeac8269d4 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -483,6 +483,12 @@ export enum EndOfLine { CRLF = 2 } +export enum EnvironmentVariableMutatorType { + Replace = 1, + Append = 2, + Prepend = 3 +} + @es5ClassCompat export class TextEdit { diff --git a/src/vs/workbench/api/node/extHostTerminalService.ts b/src/vs/workbench/api/node/extHostTerminalService.ts index d7809338f8115e859b42d4403dffc010440af1d5..5afd58b47ffaee642415ce67dd015a6719e8449f 100644 --- a/src/vs/workbench/api/node/extHostTerminalService.ts +++ b/src/vs/workbench/api/node/extHostTerminalService.ts @@ -22,6 +22,7 @@ import { getSystemShell, detectAvailableShells } from 'vs/workbench/contrib/term import { getMainProcessParentEnv } from 'vs/workbench/contrib/terminal/node/terminalEnvironment'; import { BaseExtHostTerminalService, ExtHostTerminal } from 'vs/workbench/api/common/extHostTerminalService'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; +import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; export class ExtHostTerminalService extends BaseExtHostTerminalService { @@ -215,4 +216,8 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService { public $acceptWorkspacePermissionsChanged(isAllowed: boolean): void { this._isWorkspaceShellAllowed = isAllowed; } + + public getEnvironmentVariableCollection(extension: IExtensionDescription, persistent?: boolean): vscode.EnvironmentVariableCollection { + return null!; + } }