diff options
author | Sandeep Somavarapu <sasomava@microsoft.com> | 2021-11-25 21:55:21 +0300 |
---|---|---|
committer | Sandeep Somavarapu <sasomava@microsoft.com> | 2021-11-25 21:55:21 +0300 |
commit | ab394ee788a59470092e1e8cd3e404b565c99f59 (patch) | |
tree | 7bb80a670f1f81a3c1af35e354c23cb4e25576e9 /src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts | |
parent | dd19b1d50bbff6676e7d71ce7ff8e9016c6786b2 (diff) |
#15756 support pre-release while installing through cli and commands
Diffstat (limited to 'src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts')
-rw-r--r-- | src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts index 00c9e037018..c114661a85a 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts @@ -8,7 +8,7 @@ import { KeyMod, KeyCode } from 'vs/base/common/keyCodes'; import { Registry } from 'vs/platform/registry/common/platform'; import { MenuRegistry, MenuId, registerAction2, Action2, ISubmenuItem, IMenuItem, IAction2Options } from 'vs/platform/actions/common/actions'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; -import { ExtensionsLabel, ExtensionsLocalizedLabel, ExtensionsChannelId, IExtensionManagementService, IExtensionGalleryService, PreferencesLocalizedLabel, InstallOperation } from 'vs/platform/extensionManagement/common/extensionManagement'; +import { ExtensionsLabel, ExtensionsLocalizedLabel, ExtensionsChannelId, IExtensionManagementService, IExtensionGalleryService, PreferencesLocalizedLabel, InstallOperation, InstallOptions } from 'vs/platform/extensionManagement/common/extensionManagement'; import { EnablementState, IExtensionManagementServerService, IWorkbenchExtensionEnablementService, IWorkbenchExtensionManagementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement'; import { IExtensionIgnoredRecommendationsService, IExtensionRecommendationsService } from 'vs/workbench/services/extensionRecommendations/common/extensionRecommendations'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions'; @@ -274,6 +274,11 @@ CommandsRegistry.registerCommand({ 'description': localize('workbench.extensions.installExtension.option.installOnlyNewlyAddedFromExtensionPackVSIX', "When enabled, VS Code installs only newly added extensions from the extension pack VSIX. This option is considered only while installing a VSIX."), default: false }, + 'installPreReleaseVersion': { + 'type': 'boolean', + 'description': localize('workbench.extensions.installExtension.option.installPreReleaseVersion', "When enabled, VS Code installs the pre-release version of the extension if available."), + default: false + }, 'donotSync': { 'type': 'boolean', 'description': localize('workbench.extensions.installExtension.option.donotSync', "When enabled, VS Code do not sync this extension when Settings Sync is on."), @@ -284,14 +289,18 @@ CommandsRegistry.registerCommand({ } ] }, - handler: async (accessor, arg: string | UriComponents, options?: { installOnlyNewlyAddedFromExtensionPackVSIX?: boolean, donotSync?: boolean }) => { + handler: async (accessor, arg: string | UriComponents, options?: { installOnlyNewlyAddedFromExtensionPackVSIX?: boolean, installPreReleaseVersion?: boolean, donotSync?: boolean }) => { const extensionManagementService = accessor.get(IExtensionManagementService); const extensionGalleryService = accessor.get(IExtensionGalleryService); try { if (typeof arg === 'string') { const [extension] = await extensionGalleryService.getExtensions([{ id: arg }], CancellationToken.None); if (extension) { - await extensionManagementService.installFromGallery(extension, options?.donotSync ? { isMachineScoped: true } : undefined); + const installOptions: InstallOptions = { + isMachineScoped: options?.donotSync ? true : undefined, /* do not allow syncing extensions automatically while installing through the command */ + installPreReleaseVersion: options?.installPreReleaseVersion + }; + await extensionManagementService.installFromGallery(extension, installOptions); } else { throw new Error(localize('notFound', "Extension '{0}' not found.", arg)); } |