From cf7b620598e7e48a0c532af90bc7d9517c59edfa Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Mon, 15 Jun 2020 09:34:57 -0700 Subject: [PATCH] api: finalize extensionMode Fixes #95926 --- src/vs/vscode.d.ts | 31 ++++++++++++++++ src/vs/vscode.proposed.d.ts | 37 ------------------- .../api/common/extHostExtensionService.ts | 9 ++--- src/vs/workbench/api/common/extHostTypes.ts | 2 +- 4 files changed, 35 insertions(+), 44 deletions(-) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index b9a5577777d..7e6ad3eab46 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -5420,6 +5420,30 @@ declare module 'vscode' { activate(): Thenable; } + /** + * The ExtensionMode is provided on the `ExtensionContext` and indicates the + * mode the specific extension is running in. + */ + export enum ExtensionMode { + /** + * The extension is installed normally (for example, from the marketplace + * or VSIX) in VS Code. + */ + Production = 1, + + /** + * The extension is running from an `--extensionDevelopmentPath` provided + * when launching VS Code. + */ + Development = 2, + + /** + * The extension is running from an `--extensionTestsPath` and + * the extension host is running unit tests. + */ + Test = 3, + } + /** * An extension context is a collection of utilities private to an * extension. @@ -5497,6 +5521,13 @@ declare module 'vscode' { * the parent directory is guaranteed to be existent. */ readonly logPath: string; + + /** + * The mode the extension is running in. This is specific to the current + * extension. One extension may be in `ExtensionMode.Development` while + * other extensions in the host run in `ExtensionMode.Release`. + */ + readonly extensionMode: ExtensionMode; } /** diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 07c9fa5ccff..52cb4a25235 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1700,43 +1700,6 @@ declare module 'vscode' { //#endregion - //#region @connor4312 extension mode: https://github.com/microsoft/vscode/issues/95926 - - /** - * The ExtensionMode is provided on the `ExtensionContext` and indicates the - * mode the specific extension is running in. - */ - export enum ExtensionMode { - /** - * The extension is installed normally (for example, from the marketplace - * or VSIX) in VS Code. - */ - Release = 1, - - /** - * The extension is running from an `--extensionDevelopmentPath` provided - * when launching VS Code. - */ - Development = 2, - - /** - * The extension is running from an `--extensionDevelopmentPath` and - * the extension host is running unit tests. - */ - Test = 3, - } - - export interface ExtensionContext { - /** - * The mode the extension is running in. This is specific to the current - * extension. One extension may be in `ExtensionMode.Development` while - * other extensions in the host run in `ExtensionMode.Release`. - */ - readonly extensionMode: ExtensionMode; - } - - //#endregion - //#region https://github.com/microsoft/vscode/issues/39441 export interface CompletionItem { diff --git a/src/vs/workbench/api/common/extHostExtensionService.ts b/src/vs/workbench/api/common/extHostExtensionService.ts index 83fdbfcb107..c11e3036ad9 100644 --- a/src/vs/workbench/api/common/extHostExtensionService.ts +++ b/src/vs/workbench/api/common/extHostExtensionService.ts @@ -16,7 +16,7 @@ import { ExtHostConfiguration, IExtHostConfiguration } from 'vs/workbench/api/co import { ActivatedExtension, EmptyExtension, ExtensionActivationReason, ExtensionActivationTimes, ExtensionActivationTimesBuilder, ExtensionsActivator, IExtensionAPI, IExtensionModule, HostExtension, ExtensionActivationTimesFragment } from 'vs/workbench/api/common/extHostExtensionActivator'; import { ExtHostStorage, IExtHostStorage } from 'vs/workbench/api/common/extHostStorage'; import { ExtHostWorkspace, IExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace'; -import { ExtensionActivationError, checkProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions'; +import { ExtensionActivationError } from 'vs/workbench/services/extensions/common/extensions'; import { ExtensionDescriptionRegistry } from 'vs/workbench/services/extensions/common/extensionDescriptionRegistry'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; import * as errors from 'vs/base/common/errors'; @@ -371,7 +371,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme const workspaceState = new ExtensionMemento(extensionDescription.identifier.value, false, this._storage); const extensionMode = extensionDescription.isUnderDevelopment ? (this._initData.environment.extensionTestsLocationURI ? ExtensionMode.Test : ExtensionMode.Development) - : ExtensionMode.Release; + : ExtensionMode.Production; this._logService.trace(`ExtensionService#loadExtensionContext ${extensionDescription.identifier.value}`); @@ -391,10 +391,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme get globalStoragePath() { return that._storagePath.globalValue(extensionDescription); }, asAbsolutePath(relativePath: string) { return path.join(extensionDescription.extensionLocation.fsPath, relativePath); }, get logPath() { return path.join(that._initData.logsLocation.fsPath, extensionDescription.identifier.value); }, - get extensionMode() { - checkProposedApiEnabled(extensionDescription); - return extensionMode; - }, + get extensionMode() { return extensionMode; }, get environmentVariableCollection() { return that._extHostTerminalService.getEnvironmentVariableCollection(extensionDescription); } }); }); diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index 1cae03bf240..0d7d4ffc4c2 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -2750,7 +2750,7 @@ export enum ExtensionMode { * The extension is installed normally (for example, from the marketplace * or VSIX) in VS Code. */ - Release = 1, + Production = 1, /** * The extension is running from an `--extensionDevelopmentPath` provided