Merge from vscode a348d103d1256a06a2c9b3f9b406298a9fef6898 (#15681)

* Merge from vscode a348d103d1256a06a2c9b3f9b406298a9fef6898

* Fixes and cleanup

* Distro

* Fix hygiene yarn

* delete no yarn lock changes file

* Fix hygiene

* Fix layer check

* Fix CI

* Skip lib checks

* Remove tests deleted in vs code

* Fix tests

* Distro

* Fix tests and add removed extension point

* Skip failing notebook tests for now

* Disable broken tests and cleanup build folder

* Update yarn.lock and fix smoke tests

* Bump sqlite

* fix contributed actions and file spacing

* Fix user data path

* Update yarn.locks

Co-authored-by: ADS Merger <karlb@microsoft.com>
This commit is contained in:
Charles Gagnon
2021-06-17 08:17:11 -07:00
committed by GitHub
co-authored by ADS Merger
parent fdcb97c7f7
commit 3cb2f552a6
2582 changed files with 124827 additions and 87099 deletions
@@ -15,7 +15,7 @@ import { dispose } from 'vs/base/common/lifecycle';
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, IWebExtensionsScannerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { IWorkbenchExtensionEnablementService, EnablementState, IExtensionManagementServerService, IExtensionManagementServer, IWorkbenchExtensionManagementService, 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 } from 'vs/platform/extensions/common/extensions'; // {{SQL CARBON EDIT}}
@@ -45,7 +45,6 @@ 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, 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 { IDialogService } from 'vs/platform/dialogs/common/dialogs';
@@ -58,7 +57,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 { infoIcon, manageExtensionIcon, syncEnabledIcon, syncIgnoredIcon, warningIcon } from 'vs/workbench/contrib/extensions/browser/extensionsIcons';
import { infoIcon, manageExtensionIcon, syncEnabledIcon, syncIgnoredIcon, trustIcon, warningIcon } from 'vs/workbench/contrib/extensions/browser/extensionsIcons';
import { isWeb } from 'vs/base/common/platform';
import { isWorkspaceTrustEnabled } from 'vs/workbench/services/workspaces/common/workspaceTrust';
import { IExtensionManifestPropertiesService } from 'vs/workbench/services/extensions/common/extensionManifestPropertiesService';
function getRelativeDateLabel(date: Date): string {
const delta = new Date().getTime() - date.getTime();
@@ -111,20 +113,29 @@ export class PromptExtensionInstallFailureAction extends Action {
super('extension.promptExtensionInstallFailure');
}
async run(): Promise<void> {
override async run(): Promise<void> {
if (isPromiseCanceledError(this.error)) {
return;
}
this.logService.error(this.error);
const operationMessage = this.installOperation === InstallOperation.Update ? localize('update operation', "Error while updating '{0}' extension.", this.extension.displayName || this.extension.identifier.id)
: 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)) {
if (this.error.name === INSTALL_ERROR_NOT_SUPPORTED) {
const productName = isWeb ? localize({ key: 'vscode web', comment: ['VS Code Web is the name of the product'] }, "VS Code Web") : this.productService.nameLong;
const message = localize('cannot be installed', "The '{0}' extension is not available in {1}. Click 'More Information' to learn more.", this.extension.displayName || this.extension.identifier.id, productName);
const result = await this.dialogService.show(Severity.Info, message, [localize('close', "Close"), localize('more information', "More Information")], { cancelId: 0 });
if (result.choice === 1) {
this.openerService.open(isWeb ? URI.parse('https://aka.ms/vscode-remote-codespaces') : URI.parse('https://aka.ms/vscode-remote'));
}
return;
}
if ([INSTALL_ERROR_INCOMPATIBLE, INSTALL_ERROR_MALICIOUS].includes(this.error.name)) {
await this.dialogService.show(Severity.Info, getErrorMessage(this.error), []);
return;
}
const promptChoices: IPromptChoice[] = [];
if (this.extension.gallery && this.productService.extensionsGallery) {
promptChoices.push({
@@ -141,6 +152,9 @@ export class PromptExtensionInstallFailureAction extends Action {
})
});
}
const operationMessage = this.installOperation === InstallOperation.Update ? localize('update operation', "Error while updating '{0}' extension.", this.extension.displayName || this.extension.identifier.id)
: localize('install operation', "Error while installing '{0}' extension.", this.extension.displayName || this.extension.identifier.id);
const checkLogsMessage = localize('check logs', "Please check the [log]({0}) for more details.", `command:${Constants.showWindowLogActionId}`);
this.notificationService.prompt(Severity.Error, `${operationMessage} ${checkLogsMessage}`, promptChoices);
}
@@ -164,11 +178,11 @@ export class ActionWithDropDownAction extends ExtensionAction {
private _menuActions: IAction[] = [];
get menuActions(): IAction[] { return [...this._menuActions]; }
get extension(): IExtension | null {
override get extension(): IExtension | null {
return super.extension;
}
set extension(extension: IExtension | null) {
override set extension(extension: IExtension | null) {
this.actions.forEach(a => a.extension = extension);
super.extension = extension;
}
@@ -206,7 +220,7 @@ export class ActionWithDropDownAction extends ExtensionAction {
this.class = clazz;
}
run(): Promise<void> {
override run(): Promise<void> {
const enabledActions = this.actions.filter(a => a.enabled);
return enabledActions[0].run();
}
@@ -246,7 +260,7 @@ export abstract class AbstractInstallAction extends ExtensionAction {
}
}
async run(): Promise<any> {
override async run(): Promise<any> {
if (!this.extension) {
return;
}
@@ -331,7 +345,7 @@ export class InstallAction extends AbstractInstallAction {
@IWorkbenchThemeService workbenchThemeService: IWorkbenchThemeService,
@ILabelService labelService: ILabelService,
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
@IWorkbenchExtensioManagementService private readonly workbenchExtensioManagementService: IWorkbenchExtensioManagementService,
@IWorkbenchExtensionManagementService private readonly workbenchExtensioManagementService: IWorkbenchExtensionManagementService,
@IUserDataAutoSyncEnablementService protected readonly userDataAutoSyncEnablementService: IUserDataAutoSyncEnablementService,
@IUserDataSyncResourceEnablementService protected readonly userDataSyncResourceEnablementService: IUserDataSyncResourceEnablementService,
@INotificationService readonly localNotificationService: INotificationService
@@ -397,7 +411,7 @@ export class InstallAndSyncAction extends AbstractInstallAction {
}
update(): void {
override update(): void {
super.update();
if (this.enabled) {
this.enabled = this.userDataAutoSyncEnablementService.isEnabled() && this.userDataSyncResourceEnablementService.isResourceEnabled(SyncResource.Extensions);
@@ -460,8 +474,9 @@ export abstract class InstallInOtherServerAction extends ExtensionAction {
private readonly canInstallAnyWhere: boolean,
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionManagementServerService protected readonly extensionManagementServerService: IExtensionManagementServerService,
@IProductService private readonly productService: IProductService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IProductService productService: IProductService,
@IConfigurationService configurationService: IConfigurationService,
@IExtensionManifestPropertiesService private readonly extensionManifestPropertiesService: IExtensionManifestPropertiesService,
) {
super(id, InstallInOtherServerAction.INSTALL_LABEL, InstallInOtherServerAction.Class, false);
this.update();
@@ -506,28 +521,28 @@ export abstract class InstallInOtherServerAction extends ExtensionAction {
}
// Prefers to run on UI
if (this.server === this.extensionManagementServerService.localExtensionManagementServer && prefersExecuteOnUI(this.extension.local.manifest, this.productService, this.configurationService)) {
if (this.server === this.extensionManagementServerService.localExtensionManagementServer && this.extensionManifestPropertiesService.prefersExecuteOnUI(this.extension.local.manifest)) {
return true;
}
// Prefers to run on Workspace
if (this.server === this.extensionManagementServerService.remoteExtensionManagementServer && prefersExecuteOnWorkspace(this.extension.local.manifest, this.productService, this.configurationService)) {
if (this.server === this.extensionManagementServerService.remoteExtensionManagementServer && this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(this.extension.local.manifest)) {
return true;
}
// Prefers to run on Web
if (this.server === this.extensionManagementServerService.webExtensionManagementServer && prefersExecuteOnWeb(this.extension.local.manifest, this.productService, this.configurationService)) {
if (this.server === this.extensionManagementServerService.webExtensionManagementServer && this.extensionManifestPropertiesService.prefersExecuteOnWeb(this.extension.local.manifest)) {
return true;
}
if (this.canInstallAnyWhere) {
// Can run on UI
if (this.server === this.extensionManagementServerService.localExtensionManagementServer && canExecuteOnUI(this.extension.local.manifest, this.productService, this.configurationService)) {
if (this.server === this.extensionManagementServerService.localExtensionManagementServer && this.extensionManifestPropertiesService.canExecuteOnUI(this.extension.local.manifest)) {
return true;
}
// Can run on Workspace
if (this.server === this.extensionManagementServerService.remoteExtensionManagementServer && canExecuteOnWorkspace(this.extension.local.manifest, this.productService, this.configurationService)) {
if (this.server === this.extensionManagementServerService.remoteExtensionManagementServer && this.extensionManifestPropertiesService.canExecuteOnWorkspace(this.extension.local.manifest)) {
return true;
}
}
@@ -535,7 +550,7 @@ export abstract class InstallInOtherServerAction extends ExtensionAction {
return false;
}
async run(): Promise<void> {
override async run(): Promise<void> {
if (!this.extension) {
return;
}
@@ -562,8 +577,9 @@ export class RemoteInstallAction extends InstallInOtherServerAction {
@IExtensionManagementServerService extensionManagementServerService: IExtensionManagementServerService,
@IProductService productService: IProductService,
@IConfigurationService configurationService: IConfigurationService,
@IExtensionManifestPropertiesService extensionManifestPropertiesService: IExtensionManifestPropertiesService,
) {
super(`extensions.remoteinstall`, extensionManagementServerService.remoteExtensionManagementServer, canInstallAnyWhere, extensionsWorkbenchService, extensionManagementServerService, productService, configurationService);
super(`extensions.remoteinstall`, extensionManagementServerService.remoteExtensionManagementServer, canInstallAnyWhere, extensionsWorkbenchService, extensionManagementServerService, productService, configurationService, extensionManifestPropertiesService);
}
protected getInstallLabel(): string {
@@ -581,8 +597,9 @@ export class LocalInstallAction extends InstallInOtherServerAction {
@IExtensionManagementServerService extensionManagementServerService: IExtensionManagementServerService,
@IProductService productService: IProductService,
@IConfigurationService configurationService: IConfigurationService,
@IExtensionManifestPropertiesService extensionManifestPropertiesService: IExtensionManifestPropertiesService,
) {
super(`extensions.localinstall`, extensionManagementServerService.localExtensionManagementServer, false, extensionsWorkbenchService, extensionManagementServerService, productService, configurationService);
super(`extensions.localinstall`, extensionManagementServerService.localExtensionManagementServer, false, extensionsWorkbenchService, extensionManagementServerService, productService, configurationService, extensionManifestPropertiesService);
}
protected getInstallLabel(): string {
@@ -599,15 +616,16 @@ export class WebInstallAction extends InstallInOtherServerAction {
@IProductService productService: IProductService,
@IConfigurationService configurationService: IConfigurationService,
@IWebExtensionsScannerService private readonly webExtensionsScannerService: IWebExtensionsScannerService,
@IExtensionManifestPropertiesService extensionManifestPropertiesService: IExtensionManifestPropertiesService,
) {
super(`extensions.webInstall`, extensionManagementServerService.webExtensionManagementServer, false, extensionsWorkbenchService, extensionManagementServerService, productService, configurationService);
super(`extensions.webInstall`, extensionManagementServerService.webExtensionManagementServer, false, extensionsWorkbenchService, extensionManagementServerService, productService, configurationService, extensionManifestPropertiesService);
}
protected getInstallLabel(): string {
return localize('install browser', "Install in Browser");
}
protected canInstall(): boolean {
protected override canInstall(): boolean {
if (super.canInstall()) {
return !!this.extension?.gallery && this.webExtensionsScannerService.canAddExtension(this.extension.gallery);
}
@@ -663,7 +681,7 @@ export class UninstallAction extends ExtensionAction {
this.enabled = true;
}
async run(): Promise<any> {
override async run(): Promise<any> {
if (!this.extension) {
return;
}
@@ -712,7 +730,7 @@ export class UpdateAction extends ExtensionAction {
this.label = this.extension.outdated ? this.getUpdateLabel(this.extension.latestVersion) : this.getUpdateLabel();
}
async run(): Promise<any> {
override async run(): Promise<any> {
if (!this.extension) {
return;
}
@@ -751,36 +769,6 @@ export interface IExtensionActionViewItemOptions extends IActionViewItemOptions
tabOnlyOnFocus?: boolean;
}
export class ExtensionActionViewItem extends ActionViewItem {
constructor(context: any, action: IAction, options: IExtensionActionViewItemOptions = {}) {
super(context, action, options);
}
updateEnabled(): void {
super.updateEnabled();
if (this.label && (<IExtensionActionViewItemOptions>this.options).tabOnlyOnFocus && this.getAction().enabled && !this._hasFocus) {
DOM.removeTabIndexAndUpdateFocus(this.label);
}
}
private _hasFocus: boolean = false;
setFocus(value: boolean): void {
if (!(<IExtensionActionViewItemOptions>this.options).tabOnlyOnFocus || this._hasFocus === value) {
return;
}
this._hasFocus = value;
if (this.label && this.getAction().enabled) {
if (this._hasFocus) {
this.label.tabIndex = 0;
} else {
DOM.removeTabIndexAndUpdateFocus(this.label);
}
}
}
}
export class ExtensionActionWithDropdownActionViewItem extends ActionWithDropdownActionViewItem {
constructor(
@@ -791,12 +779,12 @@ export class ExtensionActionWithDropdownActionViewItem extends ActionWithDropdow
super(null, action, options, contextMenuProvider);
}
render(container: HTMLElement): void {
override render(container: HTMLElement): void {
super.render(container);
this.updateClass();
}
updateClass(): void {
override updateClass(): void {
super.updateClass();
if (this.element && this.dropdownMenuActionViewItem && this.dropdownMenuActionViewItem.element) {
this.element.classList.toggle('empty', (<ActionWithDropDownAction>this._action).menuActions.length === 0);
@@ -804,29 +792,6 @@ export class ExtensionActionWithDropdownActionViewItem extends ActionWithDropdow
}
}
updateEnabled(): void {
super.updateEnabled();
if (this.label && (<IExtensionActionViewItemOptions>this.options).tabOnlyOnFocus && this.getAction().enabled && !this._hasFocus) {
DOM.removeTabIndexAndUpdateFocus(this.label);
}
}
private _hasFocus: boolean = false;
setFocus(value: boolean): void {
if (!(<IExtensionActionViewItemOptions>this.options).tabOnlyOnFocus || this._hasFocus === value) {
return;
}
this._hasFocus = value;
if (this.label && this.getAction().enabled) {
if (this._hasFocus) {
this.label.tabIndex = 0;
} else {
DOM.removeTabIndexAndUpdateFocus(this.label);
}
}
}
}
export abstract class ExtensionDropDownAction extends ExtensionAction {
@@ -836,7 +801,6 @@ export abstract class ExtensionDropDownAction extends ExtensionAction {
label: string,
cssClass: string,
enabled: boolean,
private readonly tabOnlyOnFocus: boolean,
@IInstantiationService protected instantiationService: IInstantiationService
) {
super(id, label, cssClass, enabled);
@@ -844,11 +808,11 @@ export abstract class ExtensionDropDownAction extends ExtensionAction {
private _actionViewItem: DropDownMenuActionViewItem | null = null;
createActionViewItem(): DropDownMenuActionViewItem {
this._actionViewItem = this.instantiationService.createInstance(DropDownMenuActionViewItem, this, this.tabOnlyOnFocus);
this._actionViewItem = this.instantiationService.createInstance(DropDownMenuActionViewItem, this);
return this._actionViewItem;
}
public run({ actionGroups, disposeActionsOnHide }: { actionGroups: IAction[][], disposeActionsOnHide: boolean }): Promise<any> {
public override run({ actionGroups, disposeActionsOnHide }: { actionGroups: IAction[][], disposeActionsOnHide: boolean }): Promise<any> {
if (this._actionViewItem) {
this._actionViewItem.showMenu(actionGroups, disposeActionsOnHide);
}
@@ -856,13 +820,12 @@ export abstract class ExtensionDropDownAction extends ExtensionAction {
}
}
export class DropDownMenuActionViewItem extends ExtensionActionViewItem {
export class DropDownMenuActionViewItem extends ActionViewItem {
constructor(action: ExtensionDropDownAction,
tabOnlyOnFocus: boolean,
@IContextMenuService private readonly contextMenuService: IContextMenuService
) {
super(null, action, { icon: true, label: true, tabOnlyOnFocus });
super(null, action, { icon: true, label: true });
}
public showMenu(menuActionGroups: IAction[][], disposeActionsOnHide: boolean): void {
@@ -890,25 +853,27 @@ export class DropDownMenuActionViewItem extends ExtensionActionViewItem {
export function getContextMenuActions(extension: IExtension | undefined | null, inExtensionEditor: boolean, instantiationService: IInstantiationService): IAction[][] {
return instantiationService.invokeFunction(accessor => {
const scopedContextKeyService = accessor.get(IContextKeyService).createScoped();
const menuService = accessor.get(IMenuService);
const extensionRecommendationsService = accessor.get(IExtensionRecommendationsService);
const extensionIgnoredRecommendationsService = accessor.get(IExtensionIgnoredRecommendationsService);
const cksOverlay: [string, any][] = [];
if (extension) {
scopedContextKeyService.createKey<string>('extension', extension.identifier.id);
scopedContextKeyService.createKey<boolean>('isBuiltinExtension', extension.isBuiltin);
scopedContextKeyService.createKey<boolean>('extensionHasConfiguration', extension.local && !!extension.local.manifest.contributes && !!extension.local.manifest.contributes.configuration);
scopedContextKeyService.createKey<boolean>('isExtensionRecommended', !!extensionRecommendationsService.getAllRecommendationsWithReason()[extension.identifier.id.toLowerCase()]);
scopedContextKeyService.createKey<boolean>('isExtensionWorkspaceRecommended', extensionRecommendationsService.getAllRecommendationsWithReason()[extension.identifier.id.toLowerCase()]?.reasonId === ExtensionRecommendationReason.Workspace);
scopedContextKeyService.createKey<boolean>('isUserIgnoredRecommendation', extensionIgnoredRecommendationsService.globalIgnoredRecommendations.some(e => e === extension.identifier.id.toLowerCase()));
scopedContextKeyService.createKey<boolean>('inExtensionEditor', inExtensionEditor);
cksOverlay.push(['extension', extension.identifier.id]);
cksOverlay.push(['isBuiltinExtension', extension.isBuiltin]);
cksOverlay.push(['extensionHasConfiguration', extension.local && !!extension.local.manifest.contributes && !!extension.local.manifest.contributes.configuration]);
cksOverlay.push(['isExtensionRecommended', !!extensionRecommendationsService.getAllRecommendationsWithReason()[extension.identifier.id.toLowerCase()]]);
cksOverlay.push(['isExtensionWorkspaceRecommended', extensionRecommendationsService.getAllRecommendationsWithReason()[extension.identifier.id.toLowerCase()]?.reasonId === ExtensionRecommendationReason.Workspace]);
cksOverlay.push(['isUserIgnoredRecommendation', extensionIgnoredRecommendationsService.globalIgnoredRecommendations.some(e => e === extension.identifier.id.toLowerCase())]);
cksOverlay.push(['inExtensionEditor', inExtensionEditor]);
if (extension.state === ExtensionState.Installed) {
scopedContextKeyService.createKey<string>('extensionStatus', 'installed');
cksOverlay.push(['extensionStatus', 'installed']);
}
}
const contextKeyService = accessor.get(IContextKeyService).createOverlay(cksOverlay);
const groups: IAction[][] = [];
const menu = menuService.createMenu(MenuId.ExtensionContext, scopedContextKeyService);
const menu = menuService.createMenu(MenuId.ExtensionContext, contextKeyService);
menu.getActions({ shouldForwardArgs: true }).forEach(([, actions]) => groups.push(actions.map(action => {
if (action instanceof SubmenuAction) {
return action;
@@ -916,7 +881,6 @@ export function getContextMenuActions(extension: IExtension | undefined | null,
return instantiationService.createInstance(MenuItemExtensionAction, action);
})));
menu.dispose();
scopedContextKeyService.dispose();
return groups;
});
@@ -935,7 +899,7 @@ export class ManageExtensionAction extends ExtensionDropDownAction {
@IWorkbenchThemeService private readonly workbenchThemeService: IWorkbenchThemeService,
) {
super(ManageExtensionAction.ID, '', '', true, true, instantiationService);
super(ManageExtensionAction.ID, '', '', true, instantiationService);
this.tooltip = localize('manage', "Manage");
@@ -985,7 +949,7 @@ export class ManageExtensionAction extends ExtensionDropDownAction {
return groups;
}
async run(): Promise<any> {
override async run(): Promise<any> {
const runtimeExtensions = await this.extensionService.getExtensions();
return super.run({ actionGroups: await this.getActionGroups(runtimeExtensions), disposeActionsOnHide: true });
}
@@ -1007,13 +971,13 @@ export class ExtensionEditorManageExtensionAction extends ExtensionDropDownActio
constructor(
@IInstantiationService instantiationService: IInstantiationService
) {
super('extensionEditor.manageExtension', '', `${ExtensionAction.ICON_ACTION_CLASS} manage ${ThemeIcon.asClassName(manageExtensionIcon)}`, true, true, instantiationService);
super('extensionEditor.manageExtension', '', `${ExtensionAction.ICON_ACTION_CLASS} manage ${ThemeIcon.asClassName(manageExtensionIcon)}`, true, instantiationService);
this.tooltip = localize('manage', "Manage");
}
update(): void { }
run(): Promise<any> {
override run(): Promise<any> {
const actionGroups: IAction[][] = [];
getContextMenuActions(this.extension, true, this.instantiationService).forEach(actions => actionGroups.push(actions));
actionGroups.forEach(group => group.forEach(extensionAction => {
@@ -1044,9 +1008,9 @@ export class MenuItemExtensionAction extends ExtensionAction {
}
}
async run(): Promise<void> {
override async run(): Promise<void> {
if (this.extension) {
return this.action.run(this.extension.identifier.id);
await this.action.run(this.extension.identifier.id);
}
}
}
@@ -1070,7 +1034,7 @@ export class InstallAnotherVersionAction extends ExtensionAction {
this.enabled = !!this.extension && !this.extension.isBuiltin && !!this.extension.gallery && this.extension.state === ExtensionState.Installed;
}
run(): Promise<any> {
override run(): Promise<any> {
if (!this.enabled) {
return Promise.resolve();
}
@@ -1123,7 +1087,7 @@ export class EnableForWorkspaceAction extends ExtensionAction {
}
}
async run(): Promise<any> {
override async run(): Promise<any> {
if (!this.extension) {
return;
}
@@ -1154,7 +1118,7 @@ export class EnableGloballyAction extends ExtensionAction {
}
}
async run(): Promise<any> {
override async run(): Promise<any> {
if (!this.extension) {
return;
}
@@ -1191,7 +1155,7 @@ export class DisableForWorkspaceAction extends ExtensionAction {
}
}
async run(): Promise<any> {
override async run(): Promise<any> {
if (!this.extension) {
return;
}
@@ -1228,7 +1192,7 @@ export class DisableGloballyAction extends ExtensionAction {
}
}
async run(): Promise<any> {
override async run(): Promise<any> {
if (!this.extension) {
return;
}
@@ -1284,8 +1248,9 @@ export class ReloadAction extends ExtensionAction {
@IExtensionService private readonly extensionService: IExtensionService,
@IWorkbenchExtensionEnablementService private readonly extensionEnablementService: IWorkbenchExtensionEnablementService,
@IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService,
@IProductService private readonly productService: IProductService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IExtensionManifestPropertiesService private readonly extensionManifestPropertiesService: IExtensionManifestPropertiesService,
@IProductService productService: IProductService,
@IConfigurationService configurationService: IConfigurationService,
) {
super('extensions.reload', localize('reloadAction', "Reload"), ReloadAction.DisabledClass, false);
this._register(this.extensionService.onDidChangeExtensions(this.updateRunningExtensions, this));
@@ -1358,7 +1323,7 @@ export class ReloadAction extends ExtensionAction {
const extensionInOtherServer = this.extensionsWorkbenchService.installed.filter(e => areSameExtensions(e.identifier, this.extension!.identifier) && e.server !== this.extension!.server)[0];
if (extensionInOtherServer) {
// This extension prefers to run on UI/Local side but is running in remote
if (runningExtensionServer === this.extensionManagementServerService.remoteExtensionManagementServer && prefersExecuteOnUI(this.extension.local!.manifest, this.productService, this.configurationService)) {
if (runningExtensionServer === this.extensionManagementServerService.remoteExtensionManagementServer && this.extensionManifestPropertiesService.prefersExecuteOnUI(this.extension.local!.manifest)) {
this.enabled = true;
this.label = localize('reloadRequired', "Reload Required");
this.tooltip = localize('enable locally', "Please reload Visual Studio Code to enable this extension locally.");
@@ -1366,7 +1331,7 @@ export class ReloadAction extends ExtensionAction {
}
// This extension prefers to run on Workspace/Remote side but is running in local
if (runningExtensionServer === this.extensionManagementServerService.localExtensionManagementServer && prefersExecuteOnWorkspace(this.extension.local!.manifest, this.productService, this.configurationService)) {
if (runningExtensionServer === this.extensionManagementServerService.localExtensionManagementServer && this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(this.extension.local!.manifest)) {
this.enabled = true;
this.label = localize('reloadRequired', "Reload Required");
this.tooltip = localize('enable remote', "Please reload Visual Studio Code to enable this extension in {0}.", this.extensionManagementServerService.remoteExtensionManagementServer?.label);
@@ -1378,7 +1343,7 @@ export class ReloadAction extends ExtensionAction {
if (this.extension.server === this.extensionManagementServerService.localExtensionManagementServer && runningExtensionServer === this.extensionManagementServerService.remoteExtensionManagementServer) {
// This extension prefers to run on UI/Local side but is running in remote
if (prefersExecuteOnUI(this.extension.local!.manifest, this.productService, this.configurationService)) {
if (this.extensionManifestPropertiesService.prefersExecuteOnUI(this.extension.local!.manifest)) {
this.enabled = true;
this.label = localize('reloadRequired', "Reload Required");
this.tooltip = localize('postEnableTooltip', "Please reload Azure Data Studio to enable this extension."); // {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
@@ -1386,7 +1351,7 @@ export class ReloadAction extends ExtensionAction {
}
if (this.extension.server === this.extensionManagementServerService.remoteExtensionManagementServer && runningExtensionServer === this.extensionManagementServerService.localExtensionManagementServer) {
// This extension prefers to run on Workspace/Remote side but is running in local
if (prefersExecuteOnWorkspace(this.extension.local!.manifest, this.productService, this.configurationService)) {
if (this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(this.extension.local!.manifest)) {
this.enabled = true;
this.label = localize('reloadRequired', "Reload Required");
this.tooltip = localize('postEnableTooltip', "Please reload Azure Data Studio to enable this extension."); // {{SQL CARBON EDIT}} - replace Visual Studio Code with Azure Data Studio
@@ -1430,7 +1395,7 @@ export class ReloadAction extends ExtensionAction {
}
}
run(): Promise<any> {
override run(): Promise<any> {
return Promise.resolve(this.hostService.reload());
}
}
@@ -1485,7 +1450,7 @@ export class SetColorThemeAction extends ExtensionAction {
this.class = this.enabled ? SetColorThemeAction.EnabledClass : SetColorThemeAction.DisabledClass;
}
async run({ showCurrentTheme, ignoreFocusLost }: { showCurrentTheme: boolean, ignoreFocusLost: boolean } = { showCurrentTheme: false, ignoreFocusLost: false }): Promise<any> {
override async run({ showCurrentTheme, ignoreFocusLost }: { showCurrentTheme: boolean, ignoreFocusLost: boolean } = { showCurrentTheme: false, ignoreFocusLost: false }): Promise<any> {
this.colorThemes = await this.workbenchThemeService.getColorThemes();
this.update();
@@ -1538,7 +1503,7 @@ export class SetFileIconThemeAction extends ExtensionAction {
this.class = this.enabled ? SetFileIconThemeAction.EnabledClass : SetFileIconThemeAction.DisabledClass;
}
async run({ showCurrentTheme, ignoreFocusLost }: { showCurrentTheme: boolean, ignoreFocusLost: boolean } = { showCurrentTheme: false, ignoreFocusLost: false }): Promise<any> {
override async run({ showCurrentTheme, ignoreFocusLost }: { showCurrentTheme: boolean, ignoreFocusLost: boolean } = { showCurrentTheme: false, ignoreFocusLost: false }): Promise<any> {
this.fileIconThemes = await this.workbenchThemeService.getFileIconThemes();
this.update();
if (!this.enabled) {
@@ -1592,7 +1557,7 @@ export class SetProductIconThemeAction extends ExtensionAction {
this.class = this.enabled ? SetProductIconThemeAction.EnabledClass : SetProductIconThemeAction.DisabledClass;
}
async run({ showCurrentTheme, ignoreFocusLost }: { showCurrentTheme: boolean, ignoreFocusLost: boolean } = { showCurrentTheme: false, ignoreFocusLost: false }): Promise<any> {
override async run({ showCurrentTheme, ignoreFocusLost }: { showCurrentTheme: boolean, ignoreFocusLost: boolean } = { showCurrentTheme: false, ignoreFocusLost: false }): Promise<any> {
this.productIconThemes = await this.workbenchThemeService.getProductIconThemes();
this.update();
if (!this.enabled) {
@@ -1628,7 +1593,7 @@ export class ShowInstalledExtensionsAction extends Action {
super(id, label, undefined, true);
}
run(): Promise<void> {
override run(): Promise<void> {
return this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => {
@@ -1653,7 +1618,7 @@ export class ShowRecommendedExtensionAction extends Action {
this.extensionId = extensionId;
}
run(): Promise<any> {
override run(): Promise<any> {
return this.viewletService.openViewlet(VIEWLET_ID, true)
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
.then(viewlet => {
@@ -1688,7 +1653,7 @@ export class InstallRecommendedExtensionAction extends Action {
this.extensionId = extensionId;
}
async run(): Promise<any> {
override async run(): Promise<any> {
const viewlet = await this.viewletService.openViewlet(VIEWLET_ID, true);
const viewPaneContainer = viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer;
viewPaneContainer.search(`@id:${this.extensionId}`);
@@ -1723,7 +1688,7 @@ export class IgnoreExtensionRecommendationAction extends Action {
this.enabled = true;
}
public run(): Promise<any> {
public override run(): Promise<any> {
this.extensionRecommendationsManagementService.toggleGlobalIgnoredRecommendation(this.extension.identifier.id, true);
return Promise.resolve();
}
@@ -1746,7 +1711,7 @@ export class UndoIgnoreExtensionRecommendationAction extends Action {
this.enabled = true;
}
public run(): Promise<any> {
public override run(): Promise<any> {
this.extensionRecommendationsManagementService.toggleGlobalIgnoredRecommendation(this.extension.identifier.id, false);
return Promise.resolve();
}
@@ -1761,7 +1726,7 @@ export class SearchExtensionsAction extends Action {
super('extensions.searchExtensions', localize('search recommendations', "Search Extensions"), undefined, true);
}
async run(): Promise<void> {
override async run(): Promise<void> {
const viewPaneContainer = (await this.viewletService.openViewlet(VIEWLET_ID, true))?.getViewPaneContainer() as IExtensionsViewPaneContainer;
viewPaneContainer.search(this.searchValue);
viewPaneContainer.focus();
@@ -1878,7 +1843,7 @@ export class ConfigureWorkspaceRecommendedExtensionsAction extends AbstractConfi
this.enabled = this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY;
}
public run(): Promise<void> {
public override run(): Promise<void> {
switch (this.contextService.getWorkbenchState()) {
case WorkbenchState.FOLDER:
return this.openExtensionsFile(this.contextService.getWorkspace().folders[0].toResource(EXTENSIONS_CONFIG));
@@ -1908,7 +1873,7 @@ export class ConfigureWorkspaceFolderRecommendedExtensionsAction extends Abstrac
super(id, label, contextService, fileService, textFileService, editorService, jsonEditingService, textModelResolverService);
}
public run(): Promise<any> {
public override run(): Promise<any> {
const folderCount = this.contextService.getWorkspace().folders.length;
const pickFolderPromise = folderCount === 1 ? Promise.resolve(this.contextService.getWorkspace().folders[0]) : this.commandService.executeCommand<IWorkspaceFolder>(PICK_WORKSPACE_FOLDER_COMMAND_ID);
return Promise.resolve(pickFolderPromise)
@@ -2017,7 +1982,7 @@ export class StatusLabelAction extends Action implements IExtensionContainer {
return null;
}
run(): Promise<any> {
override run(): Promise<any> {
return Promise.resolve();
}
@@ -2042,7 +2007,7 @@ export class MaliciousStatusLabelAction extends ExtensionAction {
}
}
run(): Promise<any> {
override run(): Promise<any> {
return Promise.resolve();
}
}
@@ -2058,7 +2023,7 @@ export class ToggleSyncExtensionAction extends ExtensionDropDownAction {
@IUserDataAutoSyncEnablementService private readonly userDataAutoSyncEnablementService: IUserDataAutoSyncEnablementService,
@IInstantiationService instantiationService: IInstantiationService,
) {
super('extensions.sync', '', ToggleSyncExtensionAction.SYNC_CLASS, false, true, instantiationService);
super('extensions.sync', '', ToggleSyncExtensionAction.SYNC_CLASS, false, instantiationService);
this._register(Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectedKeys.includes('settingsSync.ignoredExtensions'))(() => this.update()));
this._register(userDataAutoSyncEnablementService.onDidChangeEnablement(() => this.update()));
this.update();
@@ -2073,7 +2038,7 @@ export class ToggleSyncExtensionAction extends ExtensionDropDownAction {
}
}
async run(): Promise<any> {
override async run(): Promise<any> {
return super.run({
actionGroups: [
[
@@ -2159,7 +2124,7 @@ export class ExtensionToolTipAction extends ExtensionAction {
return '';
}
run(): Promise<any> {
override run(): Promise<any> {
return Promise.resolve(null);
}
}
@@ -2169,6 +2134,7 @@ export class SystemDisabledWarningAction extends ExtensionAction {
private static readonly CLASS = `${ExtensionAction.ICON_ACTION_CLASS} system-disable`;
private static readonly WARNING_CLASS = `${SystemDisabledWarningAction.CLASS} ${ThemeIcon.asClassName(warningIcon)}`;
private static readonly INFO_CLASS = `${SystemDisabledWarningAction.CLASS} ${ThemeIcon.asClassName(infoIcon)}`;
private static readonly TRUST_CLASS = `${SystemDisabledWarningAction.CLASS} ${ThemeIcon.asClassName(trustIcon)}`;
updateWhenCounterExtensionChanges: boolean = true;
private _runningExtensions: IExtensionDescription[] | null = null;
@@ -2178,8 +2144,8 @@ export class SystemDisabledWarningAction extends ExtensionAction {
@ILabelService private readonly labelService: ILabelService,
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
@IExtensionService private readonly extensionService: IExtensionService,
@IProductService private readonly productService: IProductService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IExtensionManifestPropertiesService private readonly extensionManifestPropertiesService: IExtensionManifestPropertiesService,
) {
super('extensions.install', '', `${SystemDisabledWarningAction.CLASS} hide`, false);
this._register(this.labelService.onDidChangeFormatters(() => this.update(), this));
@@ -2204,6 +2170,11 @@ export class SystemDisabledWarningAction extends ExtensionAction {
) {
return;
}
if (this.extension.enablementState === EnablementState.DisabledByVirtualWorkspace) {
this.class = `${SystemDisabledWarningAction.INFO_CLASS}`;
this.tooltip = localize('disabled because of virtual workspace', "This extension has been disabled because it does not support virtual workspaces.");
return;
}
if (this.extensionManagementServerService.localExtensionManagementServer && this.extensionManagementServerService.remoteExtensionManagementServer) {
if (isLanguagePackExtension(this.extension.local.manifest)) {
if (!this.extensionsWorkbenchService.installed.some(e => areSameExtensions(e.identifier, this.extension!.identifier) && e.server !== this.extension!.server)) {
@@ -2231,23 +2202,28 @@ export class SystemDisabledWarningAction extends ExtensionAction {
const runningExtension = this._runningExtensions.filter(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier))[0];
const runningExtensionServer = runningExtension ? this.extensionManagementServerService.getExtensionManagementServer(toExtension(runningExtension)) : null;
if (this.extension.server === this.extensionManagementServerService.localExtensionManagementServer && runningExtensionServer === this.extensionManagementServerService.remoteExtensionManagementServer) {
if (prefersExecuteOnWorkspace(this.extension.local!.manifest, this.productService, this.configurationService)) {
if (this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(this.extension.local!.manifest)) {
this.class = `${SystemDisabledWarningAction.INFO_CLASS}`;
this.tooltip = localize('disabled locally', "Extension is enabled on '{0}' and disabled locally.", this.extensionManagementServerService.remoteExtensionManagementServer.label);
}
return;
}
if (this.extension.server === this.extensionManagementServerService.remoteExtensionManagementServer && runningExtensionServer === this.extensionManagementServerService.localExtensionManagementServer) {
if (prefersExecuteOnUI(this.extension.local!.manifest, this.productService, this.configurationService)) {
if (this.extensionManifestPropertiesService.prefersExecuteOnUI(this.extension.local!.manifest)) {
this.class = `${SystemDisabledWarningAction.INFO_CLASS}`;
this.tooltip = localize('disabled remotely', "Extension is enabled locally and disabled on '{0}'.", this.extensionManagementServerService.remoteExtensionManagementServer.label);
}
return;
}
}
if (isWorkspaceTrustEnabled(this.configurationService) && this.extension.enablementState === EnablementState.DisabledByTrustRequirement) {
this.class = `${SystemDisabledWarningAction.TRUST_CLASS}`;
this.tooltip = localize('extension disabled because of trust requirement', "This extension has been disabled because the current workspace is not trusted");
return;
}
}
run(): Promise<any> {
override run(): Promise<any> {
return Promise.resolve(null);
}
}
@@ -2272,11 +2248,11 @@ export class DisableAllAction extends Action {
return this.extensionsWorkbenchService.local.filter(e => !e.isBuiltin && !!e.local && this.extensionEnablementService.isEnabled(e.local) && this.extensionEnablementService.canChangeEnablement(e.local));
}
get enabled(): boolean {
override get enabled(): boolean {
return this.getExtensionsToDisable().length > 0;
}
run(): Promise<any> {
override run(): Promise<any> {
return this.extensionsWorkbenchService.setEnablement(this.getExtensionsToDisable(), EnablementState.DisabledGlobally);
}
}
@@ -2302,11 +2278,11 @@ export class DisableAllWorkspaceAction extends Action {
return this.extensionsWorkbenchService.local.filter(e => !e.isBuiltin && !!e.local && this.extensionEnablementService.isEnabled(e.local) && this.extensionEnablementService.canChangeEnablement(e.local));
}
get enabled(): boolean {
override get enabled(): boolean {
return this.getExtensionsToDisable().length > 0;
}
run(): Promise<any> {
override run(): Promise<any> {
return this.extensionsWorkbenchService.setEnablement(this.getExtensionsToDisable(), EnablementState.DisabledWorkspace);
}
}
@@ -2331,11 +2307,11 @@ export class EnableAllAction extends Action {
return this.extensionsWorkbenchService.local.filter(e => !!e.local && this.extensionEnablementService.canChangeEnablement(e.local) && !this.extensionEnablementService.isEnabled(e.local));
}
get enabled(): boolean {
override get enabled(): boolean {
return this.getExtensionsToEnable().length > 0;
}
run(): Promise<any> {
override run(): Promise<any> {
return this.extensionsWorkbenchService.setEnablement(this.getExtensionsToEnable(), EnablementState.EnabledGlobally);
}
}
@@ -2361,11 +2337,11 @@ export class EnableAllWorkspaceAction extends Action {
return this.extensionsWorkbenchService.local.filter(e => !!e.local && this.extensionEnablementService.canChangeEnablement(e.local) && !this.extensionEnablementService.isEnabled(e.local));
}
get enabled(): boolean {
override get enabled(): boolean {
return this.getExtensionsToEnable().length > 0;
}
run(): Promise<any> {
override run(): Promise<any> {
return this.extensionsWorkbenchService.setEnablement(this.getExtensionsToEnable(), EnablementState.EnabledWorkspace);
}
}
@@ -2387,11 +2363,11 @@ export class ReinstallAction extends Action {
super(id, label);
}
get enabled(): boolean {
override get enabled(): boolean {
return this.extensionsWorkbenchService.local.filter(l => !l.isBuiltin && l.local).length > 0;
}
run(): Promise<any> {
override run(): Promise<any> {
return this.quickInputService.pick(this.getEntries(), { placeHolder: localize('selectExtensionToReinstall', "Select Extension to Reinstall") })
.then(pick => pick && this.reinstallExtension(pick.extension));
}
@@ -2456,11 +2432,11 @@ export class InstallSpecificVersionOfExtensionAction extends Action {
super(id, label);
}
get enabled(): boolean {
override get enabled(): boolean {
return this.extensionsWorkbenchService.local.some(l => this.isEnabled(l));
}
async run(): Promise<any> {
override async run(): Promise<any> {
const extensionPick = await this.quickInputService.pick(this.getExtensionEntries(), { placeHolder: localize('selectExtension', "Select Extension"), matchOnDetail: true });
if (extensionPick && extensionPick.extension) {
const versionPick = await this.quickInputService.pick(extensionPick.versions.map(v => ({ id: v.version, label: v.version, description: `${getRelativeDateLabel(new Date(Date.parse(v.date)))}${v.version === extensionPick.extension.version ? ` (${localize('current', "Current")})` : ''}` })), { placeHolder: localize('selectVersion', "Select Version to Install"), matchOnDetail: true });
@@ -2558,7 +2534,7 @@ export abstract class AbstractInstallExtensionsInServerAction extends Action {
this.tooltip = this.label;
}
async run(): Promise<void> {
override async run(): Promise<void> {
return this.selectAndInstallExtensions();
}
@@ -2629,7 +2605,7 @@ export class InstallLocalExtensionsInRemoteAction extends AbstractInstallExtensi
super('workbench.extensions.actions.installLocalExtensionsInRemote', extensionsWorkbenchService, quickInputService, notificationService, progressService);
}
get label(): string {
override get label(): string {
if (this.extensionManagementServerService && this.extensionManagementServerService.remoteExtensionManagementServer) {
return localize('select and install local extensions', "Install Local Extensions in '{0}'...", this.extensionManagementServerService.remoteExtensionManagementServer.label);
}
@@ -2682,7 +2658,7 @@ export class InstallRemoteExtensionsInLocalAction extends AbstractInstallExtensi
super(id, extensionsWorkbenchService, quickInputService, notificationService, progressService);
}
get label(): string {
override get label(): string {
return localize('select and install remote extensions', "Install Remote Extensions Locally...");
}