Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 (#14883)

* Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8

* Bump distro

* Upgrade GCC to 4.9 due to yarn install errors

* Update build image

* Fix bootstrap base url

* Bump distro

* Fix build errors

* Update source map file

* Disable checkbox for blocking migration issues (#15131)

* disable checkbox for blocking issues

* wip

* disable checkbox fixes

* fix strings

* Remove duplicate tsec command

* Default to off for tab color if settings not present

* re-skip failing tests

* Fix mocha error

* Bump sqlite version & fix notebooks search view

* Turn off esbuild warnings

* Update esbuild log level

* Fix overflowactionbar tests

* Fix ts-ignore in dropdown tests

* cleanup/fixes

* Fix hygiene

* Bundle in entire zone.js module

* Remove extra constructor param

* bump distro for web compile break

* bump distro for web compile break v2

* Undo log level change

* New distro

* Fix integration test scripts

* remove the "no yarn.lock changes" workflow

* fix scripts v2

* Update unit test scripts

* Ensure ads-kerberos2 updates in .vscodeignore

* Try fix unit tests

* Upload crash reports

* remove nogpu

* always upload crashes

* Use bash script

* Consolidate data/ext dir names

* Create in tmp directory

Co-authored-by: chlafreniere <hichise@gmail.com>
Co-authored-by: Christopher Suh <chsuh@microsoft.com>
Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
Karl Burtram
2021-04-27 14:01:59 -07:00
committed by GitHub
co-authored by chlafreniere Christopher Suh chgagnon
parent 7e1c0076ba
commit 867a963882
1817 changed files with 81812 additions and 50843 deletions
@@ -6,23 +6,21 @@
import 'vs/css!./media/extensionActions';
import { localize } from 'vs/nls';
import { IAction, Action, Separator, SubmenuAction } from 'vs/base/common/actions';
import { Delayer } from 'vs/base/common/async';
import { Delayer, Promises } from 'vs/base/common/async';
import * as DOM from 'vs/base/browser/dom';
import { Event } from 'vs/base/common/event';
import * as json from 'vs/base/common/json';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { dispose } from 'vs/base/common/lifecycle';
import { IExtension, ExtensionState, IExtensionsWorkbenchService, VIEWLET_ID, IExtensionsViewPaneContainer, AutoUpdateConfigurationKey, IExtensionContainer, TOGGLE_IGNORE_EXTENSION_ACTION_ID } from 'vs/workbench/contrib/extensions/common/extensions';
import { IExtension, ExtensionState, IExtensionsWorkbenchService, VIEWLET_ID, IExtensionsViewPaneContainer, IExtensionContainer, TOGGLE_IGNORE_EXTENSION_ACTION_ID, SELECT_INSTALL_VSIX_EXTENSION_COMMAND_ID } from 'vs/workbench/contrib/extensions/common/extensions';
import { ExtensionsConfigurationInitialContent } from 'vs/workbench/contrib/extensions/common/extensionsFileTemplate';
import { IGalleryExtension, IExtensionGalleryService, INSTALL_ERROR_MALICIOUS, INSTALL_ERROR_INCOMPATIBLE, IGalleryExtensionVersion, ILocalExtension, INSTALL_ERROR_NOT_SUPPORTED, InstallOptions, InstallOperation } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IWorkbenchExtensionEnablementService, EnablementState, IExtensionManagementServerService, IExtensionManagementServer, IWorkbenchExtensioManagementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { IWorkbenchExtensionEnablementService, EnablementState, IExtensionManagementServerService, IExtensionManagementServer, IWorkbenchExtensioManagementService, IWebExtensionsScannerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { ExtensionRecommendationReason, IExtensionIgnoredRecommendationsService, IExtensionRecommendationsService } from 'vs/workbench/services/extensionRecommendations/common/extensionRecommendations';
import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
import { ExtensionType, ExtensionIdentifier, IExtensionDescription, IExtensionManifest, isLanguagePackExtension, ExtensionsPolicy, ExtensionsPolicyKey } from 'vs/platform/extensions/common/extensions'; // {{SQL CARBON EDIT}}
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { ShowViewletAction } from 'vs/workbench/browser/viewlet';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { Query } from 'vs/workbench/contrib/extensions/common/extensionQuery';
import { IFileService, IFileContent } from 'vs/platform/files/common/files';
import { IWorkspaceContextService, WorkbenchState, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IHostService } from 'vs/workbench/services/host/browser/host';
@@ -40,22 +38,18 @@ import { MenuId, IMenuService } from 'vs/platform/actions/common/actions';
import { PICK_WORKSPACE_FOLDER_COMMAND_ID } from 'vs/workbench/browser/actions/workspaceCommands';
import { INotificationService, IPromptChoice, Severity } from 'vs/platform/notification/common/notification';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { mnemonicButtonLabel } from 'vs/base/common/labels';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IQuickPickItem, IQuickInputService, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { alert } from 'vs/base/browser/ui/aria/aria';
import { coalesce } from 'vs/base/common/arrays';
import { IWorkbenchThemeService, IWorkbenchTheme, IWorkbenchColorTheme, IWorkbenchFileIconTheme, IWorkbenchProductIconTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { ILabelService } from 'vs/platform/label/common/label';
import { prefersExecuteOnUI, prefersExecuteOnWorkspace, canExecuteOnUI, canExecuteOnWorkspace } from 'vs/workbench/services/extensions/common/extensionsUtil';
import { prefersExecuteOnUI, prefersExecuteOnWorkspace, canExecuteOnUI, canExecuteOnWorkspace, prefersExecuteOnWeb } from 'vs/workbench/services/extensions/common/extensionsUtil';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { IProductService } from 'vs/platform/product/common/productService';
import { IFileDialogService, IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { IDialogService, IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress';
import { IViewsService } from 'vs/workbench/common/views';
import { IActionViewItemOptions, ActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
import { EXTENSIONS_CONFIG, IExtensionsConfigContent } from 'vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig';
import { getErrorMessage, isPromiseCanceledError } from 'vs/base/common/errors';
@@ -64,46 +58,10 @@ import { ActionWithDropdownActionViewItem, IActionWithDropdownActionViewItemOpti
import { IContextMenuProvider } from 'vs/base/browser/contextmenu';
import { ILogService } from 'vs/platform/log/common/log';
import * as Constants from 'vs/workbench/contrib/logs/common/logConstants';
import { clearSearchResultsIcon, infoIcon, manageExtensionIcon, refreshIcon, syncEnabledIcon, syncIgnoredIcon, warningIcon } from 'vs/workbench/contrib/extensions/browser/extensionsIcons';
import { infoIcon, manageExtensionIcon, syncEnabledIcon, syncIgnoredIcon, warningIcon } from 'vs/workbench/contrib/extensions/browser/extensionsIcons';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; // {{SQL CARBON EDIT}}
import product from 'vs/platform/product/common/product';
const promptDownloadManually = (extension: IGalleryExtension | undefined, message: string, error: Error, instantiationService: IInstantiationService): Promise<any> => {
return instantiationService.invokeFunction(accessor => {
if (isPromiseCanceledError(error)) {
return Promise.resolve();
}
const productService = accessor.get(IProductService);
const openerService = accessor.get(IOpenerService);
const notificationService = accessor.get(INotificationService);
const dialogService = accessor.get(IDialogService);
const erorrsToShows = [INSTALL_ERROR_INCOMPATIBLE, INSTALL_ERROR_MALICIOUS, INSTALL_ERROR_NOT_SUPPORTED];
if (!extension || erorrsToShows.indexOf(error.name) !== -1 || !productService.extensionsGallery) {
return dialogService.show(Severity.Error, error.message, []);
} else {
const downloadUrl = (extension.assets.downloadPage && extension.assets.downloadPage.uri) || extension.assets.download.uri; // {{SQL CARBON EDIT}} Use the URI directly since we don't have a marketplace hosting the packages
notificationService.prompt(Severity.Error, message, !InstallVSIXAction.AVAILABLE ? [] : [{
label: localize('download2', "Try Downloading Manually..."),
run: () => openerService.open(URI.parse(downloadUrl)).then(() => {
notificationService.prompt(
Severity.Info,
localize('install vsix', 'Once downloaded, please manually install the downloaded VSIX of \'{0}\'.', extension.identifier.id),
[{
label: InstallVSIXAction.LABEL,
run: () => {
const action = instantiationService.createInstance(InstallVSIXAction, InstallVSIXAction.ID, InstallVSIXAction.LABEL);
action.run();
action.dispose();
}
}]
);
})
}]);
return Promise.resolve();
}
});
};
import { mnemonicButtonLabel } from 'vs/base/common/labels';
function getRelativeDateLabel(date: Date): string {
const delta = new Date().getTime() - date.getTime();
@@ -139,17 +97,18 @@ function getRelativeDateLabel(date: Date): string {
return '';
}
class PromptExtensionInstallFailureAction extends Action {
export class PromptExtensionInstallFailureAction extends Action {
constructor(
private readonly extension: IExtension,
private readonly version: string,
private readonly installOperation: InstallOperation,
private readonly error: Error,
@IProductService private readonly productService: IProductService,
@IOpenerService private readonly openerService: IOpenerService,
@INotificationService private readonly notificationService: INotificationService,
@IDialogService private readonly dialogService: IDialogService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@ICommandService private readonly commandService: ICommandService,
@ILogService private readonly logService: ILogService,
) {
super('extension.promptExtensionInstallFailure');
@@ -165,7 +124,7 @@ class PromptExtensionInstallFailureAction extends Action {
: localize('install operation', "Error while installing '{0}' extension.", this.extension.displayName || this.extension.identifier.id);
if ([INSTALL_ERROR_INCOMPATIBLE, INSTALL_ERROR_MALICIOUS, INSTALL_ERROR_NOT_SUPPORTED].includes(this.error.name)) {
await this.dialogService.show(Severity.Error, `${operationMessage}\n${getErrorMessage(this.error)}`, []);
await this.dialogService.show(Severity.Info, getErrorMessage(this.error), []);
return;
}
@@ -173,23 +132,19 @@ class PromptExtensionInstallFailureAction extends Action {
if (this.extension.gallery && this.productService.extensionsGallery) {
promptChoices.push({
label: localize('download', "Try Downloading Manually..."),
run: () => this.openerService.open(URI.parse(`${this.productService.extensionsGallery!.serviceUrl}/publishers/${this.extension.publisher}/vsextensions/${this.extension.name}/${this.extension.version}/vspackage`)).then(() => {
run: () => this.openerService.open(URI.parse(`${this.productService.extensionsGallery!.serviceUrl}/publishers/${this.extension.publisher}/vsextensions/${this.extension.name}/${this.version}/vspackage`)).then(() => {
this.notificationService.prompt(
Severity.Info,
localize('install vsix', 'Once downloaded, please manually install the downloaded VSIX of \'{0}\'.', this.extension.identifier.id),
[{
label: InstallVSIXAction.LABEL,
run: () => {
const action = this.instantiationService.createInstance(InstallVSIXAction, InstallVSIXAction.ID, InstallVSIXAction.LABEL);
action.run();
action.dispose();
}
label: localize('installVSIX', "Install from VSIX..."),
run: () => this.commandService.executeCommand(SELECT_INSTALL_VSIX_EXTENSION_COMMAND_ID)
}]
);
})
});
}
const checkLogsMessage = localize('check logs', "Please check [logs]({0}) for more details.", `command:${Constants.showWindowLogActionId}`);
const checkLogsMessage = localize('check logs', "Please check the [log]({0}) for more details.", `command:${Constants.showWindowLogActionId}`);
this.notificationService.prompt(Severity.Error, `${operationMessage} ${checkLogsMessage}`, promptChoices);
}
}
@@ -342,7 +297,7 @@ export abstract class AbstractInstallAction extends ExtensionAction {
console.error(error);
await this.instantiationService.createInstance(PromptExtensionInstallFailureAction, extension, InstallOperation.Install, error).run();
await this.instantiationService.createInstance(PromptExtensionInstallFailureAction, extension, extension.latestVersion, InstallOperation.Install, error).run();
return undefined;
}
}
@@ -536,7 +491,7 @@ export abstract class InstallInOtherServerAction extends ExtensionAction {
}
}
private canInstall(): boolean {
protected canInstall(): boolean {
// Disable if extension is not installed or not an user extension
if (
!this.extension
@@ -544,7 +499,7 @@ export abstract class InstallInOtherServerAction extends ExtensionAction {
|| !this.extension.local
|| this.extension.state !== ExtensionState.Installed
|| this.extension.type !== ExtensionType.User
|| this.extension.enablementState === EnablementState.DisabledByEnvironemt
|| this.extension.enablementState === EnablementState.DisabledByEnvironment
) {
return false;
}
@@ -563,6 +518,11 @@ export abstract class InstallInOtherServerAction extends ExtensionAction {
return true;
}
// Prefers to run on Web
if (this.server === this.extensionManagementServerService.webExtensionManagementServer && prefersExecuteOnWeb(this.extension.local.manifest, this.productService, this.configurationService)) {
return true;
}
if (this.canInstallAnyWhere) {
// Can run on UI
if (this.server === this.extensionManagementServerService.localExtensionManagementServer && canExecuteOnUI(this.extension.local.manifest, this.productService, this.configurationService)) {
@@ -634,6 +594,31 @@ export class LocalInstallAction extends InstallInOtherServerAction {
}
export class WebInstallAction extends InstallInOtherServerAction {
constructor(
@IExtensionsWorkbenchService extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionManagementServerService extensionManagementServerService: IExtensionManagementServerService,
@IProductService productService: IProductService,
@IConfigurationService configurationService: IConfigurationService,
@IWebExtensionsScannerService private readonly webExtensionsScannerService: IWebExtensionsScannerService,
) {
super(`extensions.webInstall`, extensionManagementServerService.webExtensionManagementServer, false, extensionsWorkbenchService, extensionManagementServerService, productService, configurationService);
}
protected getInstallLabel(): string {
return localize('install browser', "Install in Browser");
}
protected canInstall(): boolean {
if (super.canInstall()) {
return !!this.extension?.gallery && this.webExtensionsScannerService.canAddExtension(this.extension.gallery);
}
return false;
}
}
export class UninstallAction extends ExtensionAction {
static readonly UninstallLabel = localize('uninstallAction', "Uninstall");
@@ -756,7 +741,7 @@ export class UpdateAction extends ExtensionAction {
console.error(err);
return promptDownloadManually(extension.gallery, localize('failedToUpdate', "Failed to update \'{0}\'.", extension.identifier.id), err, this.instantiationService);
this.instantiationService.createInstance(PromptExtensionInstallFailureAction, extension, extension.latestVersion, InstallOperation.Update, err).run();
}
}
@@ -816,7 +801,8 @@ export class ExtensionActionWithDropdownActionViewItem extends ActionWithDropdow
updateClass(): void {
super.updateClass();
if (this.dropdownMenuActionViewItem && this.dropdownMenuActionViewItem.element) {
if (this.element && this.dropdownMenuActionViewItem && this.dropdownMenuActionViewItem.element) {
this.element.classList.toggle('empty', (<ActionWithDropDownAction>this._action).menuActions.length === 0);
this.dropdownMenuActionViewItem.element.classList.toggle('hide', (<ActionWithDropDownAction>this._action).menuActions.length === 0);
}
}
@@ -1104,7 +1090,7 @@ export class InstallAnotherVersionAction extends ExtensionAction {
await this.extensionsWorkbenchService.installVersion(this.extension!, pick.id);
}
} catch (error) {
this.instantiationService.createInstance(PromptExtensionInstallFailureAction, this.extension!, InstallOperation.Install, error).run();
this.instantiationService.createInstance(PromptExtensionInstallFailureAction, this.extension!, pick.latest ? this.extension!.latestVersion : pick.id, InstallOperation.Install, error).run();
}
}
return null;
@@ -1287,140 +1273,6 @@ export class DisableDropDownAction extends ActionWithDropDownAction {
}
export class CheckForUpdatesAction extends Action {
static readonly ID = 'workbench.extensions.action.checkForUpdates';
static readonly LABEL = localize('checkForUpdates', "Check for Extension Updates");
constructor(
id = CheckForUpdatesAction.ID,
label = CheckForUpdatesAction.LABEL,
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
@IWorkbenchExtensionEnablementService private readonly extensionEnablementService: IWorkbenchExtensionEnablementService,
@IViewletService private readonly viewletService: IViewletService,
@INotificationService private readonly notificationService: INotificationService
) {
super(id, label, '', true);
}
private checkUpdatesAndNotify(): void {
const outdated = this.extensionsWorkbenchService.outdated;
if (!outdated.length) {
this.notificationService.info(localize('noUpdatesAvailable', "All extensions are up to date."));
return;
}
let msgAvailableExtensions = outdated.length === 1 ? localize('singleUpdateAvailable', "An extension update is available.") : localize('updatesAvailable', "{0} extension updates are available.", outdated.length);
const disabledExtensionsCount = outdated.filter(ext => ext.local && !this.extensionEnablementService.isEnabled(ext.local)).length;
if (disabledExtensionsCount) {
if (outdated.length === 1) {
msgAvailableExtensions = localize('singleDisabledUpdateAvailable', "An update to an extension which is disabled is available.");
} else if (disabledExtensionsCount === 1) {
msgAvailableExtensions = localize('updatesAvailableOneDisabled', "{0} extension updates are available. One of them is for a disabled extension.", outdated.length);
} else if (disabledExtensionsCount === outdated.length) {
msgAvailableExtensions = localize('updatesAvailableAllDisabled', "{0} extension updates are available. All of them are for disabled extensions.", outdated.length);
} else {
msgAvailableExtensions = localize('updatesAvailableIncludingDisabled', "{0} extension updates are available. {1} of them are for disabled extensions.", outdated.length, disabledExtensionsCount);
}
}
this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => viewlet.search(''));
this.notificationService.info(msgAvailableExtensions);
}
run(): Promise<any> {
return this.extensionsWorkbenchService.checkForUpdates().then(() => this.checkUpdatesAndNotify());
}
}
export class ToggleAutoUpdateAction extends Action {
constructor(
id: string,
label: string,
private autoUpdateValue: boolean,
@IConfigurationService private readonly configurationService: IConfigurationService
) {
super(id, label, '', true);
this.updateEnablement();
configurationService.onDidChangeConfiguration(() => this.updateEnablement());
}
private updateEnablement(): void {
this.enabled = this.configurationService.getValue(AutoUpdateConfigurationKey) !== this.autoUpdateValue;
}
run(): Promise<any> {
return this.configurationService.updateValue(AutoUpdateConfigurationKey, this.autoUpdateValue);
}
}
export class EnableAutoUpdateAction extends ToggleAutoUpdateAction {
static readonly ID = 'workbench.extensions.action.enableAutoUpdate';
static readonly LABEL = localize('enableAutoUpdate', "Enable Auto Updating Extensions");
constructor(
id = EnableAutoUpdateAction.ID,
label = EnableAutoUpdateAction.LABEL,
@IConfigurationService configurationService: IConfigurationService
) {
super(id, label, true, configurationService);
}
}
export class DisableAutoUpdateAction extends ToggleAutoUpdateAction {
static readonly ID = 'workbench.extensions.action.disableAutoUpdate';
static readonly LABEL = localize('disableAutoUpdate', "Disable Auto Updating Extensions");
constructor(
id = EnableAutoUpdateAction.ID,
label = EnableAutoUpdateAction.LABEL,
@IConfigurationService configurationService: IConfigurationService
) {
super(id, label, false, configurationService);
}
}
export class UpdateAllAction extends Action {
static readonly ID = 'workbench.extensions.action.updateAllExtensions';
static readonly LABEL = localize('updateAll', "Update All Extensions");
constructor(
id: string, label: string, isPrimary: boolean,
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
) {
super(id, label, '', false);
if (isPrimary) {
this._register(this.extensionsWorkbenchService.onChange(() => this._onDidChange.fire({ enabled: this.enabled })));
}
}
get enabled(): boolean {
return this.extensionsWorkbenchService.outdated.length > 0;
}
run(): Promise<any> {
return Promise.all(this.extensionsWorkbenchService.outdated.map(e => this.install(e)));
}
private async install(extension: IExtension): Promise<void> {
try {
await this.extensionsWorkbenchService.install(extension);
} catch (err) {
this.instantiationService.createInstance(PromptExtensionInstallFailureAction, extension, InstallOperation.Update, err).run();
}
}
}
export class ReloadAction extends ExtensionAction {
private static readonly EnabledClass = `${ExtensionAction.LABEL_ACTION_CLASS} reload`;
@@ -1470,11 +1322,12 @@ export class ReloadAction extends ExtensionAction {
}
const isUninstalled = this.extension.state === ExtensionState.Uninstalled;
const runningExtension = this._runningExtensions.filter(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier))[0];
const isSameExtensionRunning = runningExtension && this.extension.server === this.extensionManagementServerService.getExtensionManagementServer(toExtension(runningExtension));
const runningExtension = this._runningExtensions.find(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier));
if (isUninstalled) {
if (isSameExtensionRunning && !this.extensionService.canRemoveExtension(runningExtension)) {
const canRemoveRunningExtension = runningExtension && this.extensionService.canRemoveExtension(runningExtension);
const isSameExtensionRunning = runningExtension && (!this.extension.server || this.extension.server === this.extensionManagementServerService.getExtensionManagementServer(toExtension(runningExtension)));
if (!canRemoveRunningExtension && isSameExtensionRunning) {
this.enabled = true;
this.label = localize('reloadRequired', "Reload Required");
// {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
@@ -1484,6 +1337,7 @@ export class ReloadAction extends ExtensionAction {
return;
}
if (this.extension.local) {
const isSameExtensionRunning = runningExtension && this.extension.server === this.extensionManagementServerService.getExtensionManagementServer(toExtension(runningExtension));
const isEnabled = this.extensionEnablementService.isEnabled(this.extension.local);
// Extension is running
@@ -1763,49 +1617,6 @@ export class SetProductIconThemeAction extends ExtensionAction {
}
}
export class OpenExtensionsViewletAction extends ShowViewletAction {
static ID = VIEWLET_ID;
static LABEL = localize('toggleExtensionsViewlet', "Show Extensions");
constructor(
id: string,
label: string,
@IViewletService viewletService: IViewletService,
@IEditorGroupsService editorGroupService: IEditorGroupsService,
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService
) {
super(id, label, VIEWLET_ID, viewletService, editorGroupService, layoutService);
}
}
export class InstallExtensionsAction extends OpenExtensionsViewletAction {
static ID = 'workbench.extensions.action.installExtensions';
static LABEL = localize('installExtensions', "Install Extensions");
}
export class ShowEnabledExtensionsAction extends Action {
static readonly ID = 'workbench.extensions.action.showEnabledExtensions';
static readonly LABEL = localize('showEnabledExtensions', "Show Enabled Extensions");
constructor(
id: string,
label: string,
@IViewletService private readonly viewletService: IViewletService
) {
super(id, label, undefined, true);
}
run(): Promise<void> {
return this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => {
viewlet.search('@enabled ');
viewlet.focus();
});
}
}
export class ShowInstalledExtensionsAction extends Action {
@@ -1829,230 +1640,6 @@ export class ShowInstalledExtensionsAction extends Action {
});
}
}
export class ShowDisabledExtensionsAction extends Action {
static readonly ID = 'workbench.extensions.action.showDisabledExtensions';
static readonly LABEL = localize('showDisabledExtensions', "Show Disabled Extensions");
constructor(
id: string,
label: string,
@IViewletService private readonly viewletService: IViewletService
) {
super(id, label, 'null', true);
}
run(): Promise<void> {
return this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => {
viewlet.search('@disabled ');
viewlet.focus();
});
}
}
export class ClearExtensionsSearchResultsAction extends Action {
static readonly ID = 'workbench.extensions.action.clearExtensionsSearchResults';
static readonly LABEL = localize('clearExtensionsSearchResults', "Clear Extensions Search Results");
constructor(
id: string,
label: string,
@IViewsService private readonly viewsService: IViewsService
) {
super(id, label, ThemeIcon.asClassName(clearSearchResultsIcon), true);
}
async run(): Promise<void> {
const viewPaneContainer = this.viewsService.getActiveViewPaneContainerWithId(VIEWLET_ID);
if (viewPaneContainer) {
const extensionsViewPaneContainer = viewPaneContainer as IExtensionsViewPaneContainer;
extensionsViewPaneContainer.search('');
extensionsViewPaneContainer.focus();
}
}
}
export class ClearExtensionsInputAction extends ClearExtensionsSearchResultsAction {
constructor(
id: string,
label: string,
onSearchChange: Event<string>,
getValue: () => string,
@IViewsService viewsService: IViewsService
) {
super(id, label, viewsService);
this.onSearchChange(getValue());
this._register(onSearchChange(this.onSearchChange, this));
}
private onSearchChange(value: string): void {
this.enabled = !!value;
}
}
export class RefreshExtensionsAction extends Action {
static readonly ID = 'workbench.extensions.action.refreshExtension';
static readonly LABEL = localize('refreshExtension', "Refresh");
constructor(
id: string,
label: string,
@IViewsService private readonly viewsService: IViewsService
) {
super(id, label, ThemeIcon.asClassName(refreshIcon), true);
}
async run(): Promise<void> {
const viewPaneContainer = this.viewsService.getActiveViewPaneContainerWithId(VIEWLET_ID);
if (viewPaneContainer) {
const extensionsViewPaneContainer = viewPaneContainer as IExtensionsViewPaneContainer;
return extensionsViewPaneContainer.refresh();
}
}
}
export class ShowBuiltInExtensionsAction extends Action {
static readonly ID = 'workbench.extensions.action.listBuiltInExtensions';
static readonly LABEL = localize('showBuiltInExtensions', "Show Built-in Extensions");
constructor(
id: string,
label: string,
@IViewletService private readonly viewletService: IViewletService
) {
super(id, label, undefined, true);
}
run(): Promise<void> {
return this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => {
viewlet.search('@builtin ');
viewlet.focus();
});
}
}
export class ShowOutdatedExtensionsAction extends Action {
static readonly ID = 'workbench.extensions.action.listOutdatedExtensions';
static readonly LABEL = localize('showOutdatedExtensions', "Show Outdated Extensions");
constructor(
id: string,
label: string,
@IViewletService private readonly viewletService: IViewletService
) {
super(id, label, undefined, true);
}
run(): Promise<void> {
return this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => {
viewlet.search('@outdated ');
viewlet.focus();
});
}
}
export class ShowPopularExtensionsAction extends Action {
static readonly ID = 'workbench.extensions.action.showPopularExtensions';
static readonly LABEL = localize('showPopularExtensions', "Show Popular Extensions");
constructor(
id: string,
label: string,
@IViewletService private readonly viewletService: IViewletService
) {
super(id, label, undefined, true);
}
run(): Promise<void> {
return this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => {
viewlet.search('@popular ');
viewlet.focus();
});
}
}
export class PredefinedExtensionFilterAction extends Action {
constructor(
id: string,
label: string,
private readonly filter: string,
@IViewletService private readonly viewletService: IViewletService
) {
super(id, label, undefined, true);
}
run(): Promise<void> {
return this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => {
viewlet.search(`${this.filter} `);
viewlet.focus();
});
}
}
export class RecentlyPublishedExtensionsAction extends Action {
static readonly ID = 'workbench.extensions.action.recentlyPublishedExtensions';
static readonly LABEL = localize('recentlyPublishedExtensions', "Recently Published Extensions");
constructor(
id: string,
label: string,
@IViewletService private readonly viewletService: IViewletService
) {
super(id, label, undefined, true);
}
run(): Promise<void> {
return this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => {
viewlet.search('@sort:publishedDate ');
viewlet.focus();
});
}
}
export class ShowRecommendedExtensionsAction extends Action {
static readonly ID = 'workbench.extensions.action.showRecommendedExtensions';
static readonly LABEL = localize('showRecommendedExtensions', "Show Recommended Extensions");
constructor(
id: string,
label: string,
@IViewletService private readonly viewletService: IViewletService
) {
super(id, label, undefined, true);
}
run(): Promise<void> {
return this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => {
viewlet.search('@recommended ');
viewlet.focus();
});
}
}
export class ShowRecommendedExtensionAction extends Action {
static readonly ID = 'workbench.extensions.action.showRecommendedExtension';
@@ -2116,7 +1703,7 @@ export class InstallRecommendedExtensionAction extends Action {
try {
await this.extensionWorkbenchService.install(extension);
} catch (err) {
this.instantiationService.createInstance(PromptExtensionInstallFailureAction, extension, InstallOperation.Install, err).run();
this.instantiationService.createInstance(PromptExtensionInstallFailureAction, extension, extension.latestVersion, InstallOperation.Install, err).run();
}
}
}
@@ -2168,68 +1755,6 @@ export class UndoIgnoreExtensionRecommendationAction extends Action {
}
}
export class ShowRecommendedKeymapExtensionsAction extends Action {
static readonly ID = 'workbench.extensions.action.showRecommendedKeymapExtensions';
static readonly LABEL = localize('showRecommendedKeymapExtensionsShort', "Keymaps");
constructor(
id: string,
label: string,
@IViewletService private readonly viewletService: IViewletService
) {
super(id, label, undefined, true);
}
run(): Promise<void> {
return this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => {
viewlet.search('@recommended:keymaps ');
viewlet.focus();
});
}
}
export class ShowLanguageExtensionsAction extends Action {
static readonly ID = 'workbench.extensions.action.showLanguageExtensions';
static readonly LABEL = localize('showLanguageExtensionsShort', "Language Extensions");
constructor(
id: string,
label: string,
@IViewletService private readonly viewletService: IViewletService
) {
super(id, label, undefined, true);
}
run(): Promise<void> {
return this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => {
viewlet.search('@category:"programming languages" @sort:installs ');
viewlet.focus();
});
}
}
export class SearchCategoryAction extends Action {
constructor(
id: string,
label: string,
private readonly category: string,
@IViewletService private readonly viewletService: IViewletService
) {
super(id, label, undefined, true);
}
run(): Promise<void> {
return new SearchExtensionsAction(`@category:"${this.category.toLowerCase()}"`, this.viewletService).run();
}
}
export class SearchExtensionsAction extends Action {
constructor(
@@ -2246,46 +1771,6 @@ export class SearchExtensionsAction extends Action {
}
}
export class ChangeSortAction extends Action {
private query: Query;
constructor(
id: string,
label: string,
onSearchChange: Event<string>,
private sortBy: string,
@IViewletService private readonly viewletService: IViewletService
) {
super(id, label, undefined, true);
if (sortBy === undefined) {
throw new Error('bad arguments');
}
this.query = Query.parse('');
this.enabled = false;
this.checked = false;
this._register(onSearchChange(this.onSearchChange, this));
}
private onSearchChange(value: string): void {
const query = Query.parse(value);
this.query = new Query(query.value, this.sortBy || query.sortBy, query.groupBy);
this.enabled = !!value && this.query.isValid();
this.checked = this.enabled && this.query.equals(query);
}
run(): Promise<void> {
return this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => {
viewlet.search(this.query.toString());
viewlet.focus();
});
}
}
export abstract class AbstractConfigureRecommendedExtensionsAction extends Action {
constructor(
@@ -2424,12 +1909,6 @@ export class ConfigureWorkspaceFolderRecommendedExtensionsAction extends Abstrac
@ICommandService private readonly commandService: ICommandService
) {
super(id, label, contextService, fileService, textFileService, editorService, jsonEditingService, textModelResolverService);
this._register(this.contextService.onDidChangeWorkspaceFolders(() => this.update(), this));
this.update();
}
private update(): void {
this.enabled = this.contextService.getWorkspace().folders.length > 0;
}
public run(): Promise<any> {
@@ -3042,7 +2521,7 @@ export class ReinstallAction extends Action {
}
private reinstallExtension(extension: IExtension): Promise<void> {
return this.instantiationService.createInstance(ShowInstalledExtensionsAction, ShowInstalledExtensionsAction.ID, ShowInstalledExtensionsAction.LABEL).run()
return this.instantiationService.createInstance(SearchExtensionsAction, '@installed ').run()
.then(() => {
return this.extensionsWorkbenchService.reinstall(extension)
.then(extension => {
@@ -3129,7 +2608,7 @@ export class InstallSpecificVersionOfExtensionAction extends Action {
}
private install(extension: IExtension, version: string): Promise<void> {
return this.instantiationService.createInstance(ShowInstalledExtensionsAction, ShowInstalledExtensionsAction.ID, ShowInstalledExtensionsAction.LABEL).run()
return this.instantiationService.createInstance(SearchExtensionsAction, '@installed ').run()
.then(() => {
return this.extensionsWorkbenchService.installVersion(extension, version)
.then(extension => {
@@ -3279,7 +2758,7 @@ export class InstallLocalExtensionsInRemoteAction extends AbstractInstallExtensi
protected async installExtensions(localExtensionsToInstall: IExtension[]): Promise<void> {
const galleryExtensions: IGalleryExtension[] = [];
const vsixs: URI[] = [];
await Promise.all(localExtensionsToInstall.map(async extension => {
await Promises.settled(localExtensionsToInstall.map(async extension => {
if (this.extensionGalleryService.isEnabled()) {
const gallery = await this.extensionGalleryService.getCompatibleExtension(extension.identifier, extension.version);
if (gallery) {
@@ -3291,8 +2770,8 @@ export class InstallLocalExtensionsInRemoteAction extends AbstractInstallExtensi
vsixs.push(vsix);
}));
await Promise.all(galleryExtensions.map(gallery => this.extensionManagementServerService.remoteExtensionManagementServer!.extensionManagementService.installFromGallery(gallery)));
await Promise.all(vsixs.map(vsix => this.extensionManagementServerService.remoteExtensionManagementServer!.extensionManagementService.install(vsix)));
await Promises.settled(galleryExtensions.map(gallery => this.extensionManagementServerService.remoteExtensionManagementServer!.extensionManagementService.installFromGallery(gallery)));
await Promises.settled(vsixs.map(vsix => this.extensionManagementServerService.remoteExtensionManagementServer!.extensionManagementService.install(vsix)));
}
}
@@ -3327,7 +2806,7 @@ export class InstallRemoteExtensionsInLocalAction extends AbstractInstallExtensi
protected async installExtensions(extensions: IExtension[]): Promise<void> {
const galleryExtensions: IGalleryExtension[] = [];
const vsixs: URI[] = [];
await Promise.all(extensions.map(async extension => {
await Promises.settled(extensions.map(async extension => {
if (this.extensionGalleryService.isEnabled()) {
const gallery = await this.extensionGalleryService.getCompatibleExtension(extension.identifier, extension.version);
if (gallery) {
@@ -3339,8 +2818,8 @@ export class InstallRemoteExtensionsInLocalAction extends AbstractInstallExtensi
vsixs.push(vsix);
}));
await Promise.all(galleryExtensions.map(gallery => this.extensionManagementServerService.localExtensionManagementServer!.extensionManagementService.installFromGallery(gallery)));
await Promise.all(vsixs.map(vsix => this.extensionManagementServerService.localExtensionManagementServer!.extensionManagementService.install(vsix)));
await Promises.settled(galleryExtensions.map(gallery => this.extensionManagementServerService.localExtensionManagementServer!.extensionManagementService.installFromGallery(gallery)));
await Promises.settled(vsixs.map(vsix => this.extensionManagementServerService.localExtensionManagementServer!.extensionManagementService.install(vsix)));
}
}