mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-30 08:40:29 -04:00
Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2 (#8911)
* Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2 * update distro * fix layering * update distro * fix tests
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
import { localize } from 'vs/nls';
|
||||
import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { SyncActionDescriptor, MenuRegistry, MenuId, registerAction2, Action2 } from 'vs/platform/actions/common/actions';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { ExtensionsLabel, ExtensionsChannelId, PreferencesLabel, IExtensionManagementService, IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionManagementServerService, IExtensionTipsService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
|
||||
@@ -44,6 +44,9 @@ import { ExtensionType, ExtensionsPolicy } from 'vs/platform/extensions/common/e
|
||||
import { RemoteExtensionsInstaller } from 'vs/workbench/contrib/extensions/browser/remoteExtensionsInstaller';
|
||||
import { ExtensionTipsService } from 'vs/workbench/contrib/extensions/browser/extensionTipsService';
|
||||
import { IViewContainersRegistry, ViewContainerLocation, Extensions as ViewContainerExtensions } from 'vs/workbench/common/views';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
// Singletons
|
||||
registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService);
|
||||
@@ -79,7 +82,7 @@ Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegis
|
||||
{
|
||||
id: VIEWLET_ID,
|
||||
name: localize('extensions', "Extensions"),
|
||||
ctorDescriptor: { ctor: ExtensionsViewPaneContainer },
|
||||
ctorDescriptor: new SyncDescriptor(ExtensionsViewPaneContainer),
|
||||
icon: 'codicon-extensions',
|
||||
order: 14 // {{SQL CARBON EDIT}}
|
||||
}, ViewContainerLocation.Sidebar);
|
||||
@@ -344,6 +347,75 @@ MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
||||
order: 3
|
||||
});
|
||||
|
||||
// Extension Context Menu
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
id: 'workbench.extensions.action.copyExtension',
|
||||
title: { value: localize('workbench.extensions.action.copyExtension', "Copy"), original: 'Copy' },
|
||||
menu: {
|
||||
id: MenuId.ExtensionContext,
|
||||
group: '1_copy'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(accessor: ServicesAccessor, extensionId: string) {
|
||||
const extensionWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
||||
let extension = extensionWorkbenchService.local.filter(e => areSameExtensions(e.identifier, { id: extensionId }))[0]
|
||||
|| (await extensionWorkbenchService.queryGallery({ names: [extensionId], pageSize: 1 }, CancellationToken.None)).firstPage[0];
|
||||
if (extension) {
|
||||
const name = localize('extensionInfoName', 'Name: {0}', extension.displayName);
|
||||
const id = localize('extensionInfoId', 'Id: {0}', extensionId);
|
||||
const description = localize('extensionInfoDescription', 'Description: {0}', extension.description);
|
||||
const verision = localize('extensionInfoVersion', 'Version: {0}', extension.version);
|
||||
const publisher = localize('extensionInfoPublisher', 'Publisher: {0}', extension.publisherDisplayName);
|
||||
const link = extension.url ? localize('extensionInfoVSMarketplaceLink', 'VS Marketplace Link: {0}', `${extension.url}`) : null;
|
||||
const clipboardStr = `${name}\n${id}\n${description}\n${verision}\n${publisher}${link ? '\n' + link : ''}`;
|
||||
await accessor.get(IClipboardService).writeText(clipboardStr);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
id: 'workbench.extensions.action.copyExtensionId',
|
||||
title: { value: localize('workbench.extensions.action.copyExtensionId', "Copy Extension Id"), original: 'Copy Extension Id' },
|
||||
menu: {
|
||||
id: MenuId.ExtensionContext,
|
||||
group: '1_copy'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(accessor: ServicesAccessor, id: string) {
|
||||
await accessor.get(IClipboardService).writeText(id);
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends Action2 {
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
id: 'workbench.extensions.action.configure',
|
||||
title: { value: localize('workbench.extensions.action.configure', "Configure..."), original: 'Configure...' },
|
||||
menu: {
|
||||
id: MenuId.ExtensionContext,
|
||||
group: '2_configure',
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.equals('extensionStatus', 'installed'), ContextKeyExpr.has('extensionHasConfiguration'))
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(accessor: ServicesAccessor, id: string) {
|
||||
await accessor.get(IPreferencesService).openSettings(false, `@ext:${id}`);
|
||||
}
|
||||
});
|
||||
|
||||
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
|
||||
|
||||
class ExtensionsContributions implements IWorkbenchContribution {
|
||||
|
||||
@@ -39,7 +39,7 @@ import { ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { PagedModel } from 'vs/base/common/paging';
|
||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { MenuRegistry, MenuId, IMenuService } from 'vs/platform/actions/common/actions';
|
||||
import { PICK_WORKSPACE_FOLDER_COMMAND_ID } from 'vs/workbench/browser/actions/workspaceCommands';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
@@ -55,10 +55,8 @@ import { coalesce } from 'vs/base/common/arrays';
|
||||
import { IWorkbenchThemeService, COLOR_THEME_SETTING, ICON_THEME_SETTING, IFileIconTheme, IColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { prefersExecuteOnUI, prefersExecuteOnWorkspace } from 'vs/workbench/services/extensions/common/extensionsUtil';
|
||||
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { IFileDialogService, IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress';
|
||||
|
||||
@@ -681,6 +679,14 @@ export class DropDownMenuActionViewItem extends ExtensionActionViewItem {
|
||||
}
|
||||
}
|
||||
|
||||
export function getContextMenuActions(menuService: IMenuService, contextKeyService: IContextKeyService): ExtensionAction[][] {
|
||||
const groups: ExtensionAction[][] = [];
|
||||
const menu = menuService.createMenu(MenuId.ExtensionContext, contextKeyService);
|
||||
menu.getActions({ shouldForwardArgs: true }).forEach(([, actions]) => groups.push(actions.map(action => new MenuItemExtensionAction(action))));
|
||||
menu.dispose();
|
||||
return groups;
|
||||
}
|
||||
|
||||
export class ManageExtensionAction extends ExtensionDropDownAction {
|
||||
|
||||
static readonly ID = 'extensions.manage';
|
||||
@@ -690,7 +696,9 @@ export class ManageExtensionAction extends ExtensionDropDownAction {
|
||||
constructor(
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@IExtensionService private readonly extensionService: IExtensionService,
|
||||
@IWorkbenchThemeService private readonly workbenchThemeService: IWorkbenchThemeService
|
||||
@IWorkbenchThemeService private readonly workbenchThemeService: IWorkbenchThemeService,
|
||||
@IMenuService private readonly menuService: IMenuService,
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService,
|
||||
) {
|
||||
|
||||
super(ManageExtensionAction.ID, '', '', true, true, instantiationService);
|
||||
@@ -727,11 +735,10 @@ export class ManageExtensionAction extends ExtensionDropDownAction {
|
||||
groups.push([this.instantiationService.createInstance(UninstallAction)]);
|
||||
groups.push([this.instantiationService.createInstance(InstallAnotherVersionAction)]);
|
||||
|
||||
const extensionActions: ExtensionAction[] = [this.instantiationService.createInstance(CopyExtensionInfoAction), this.instantiationService.createInstance(CopyExtensionIdAction)];
|
||||
if (this.extension && this.extension.local && this.extension.local.manifest.contributes && this.extension.local.manifest.contributes.configuration) {
|
||||
extensionActions.push(this.instantiationService.createInstance(ExtensionSettingsAction));
|
||||
}
|
||||
groups.push(extensionActions);
|
||||
const contextKeyService = this.contextKeyService.createScoped();
|
||||
contextKeyService.createKey('extensionStatus', 'installed');
|
||||
contextKeyService.createKey<boolean>('extensionHasConfiguration', !!this.extension && !!this.extension.local && !!this.extension.local.manifest.contributes && !!this.extension.local.manifest.contributes.configuration);
|
||||
getContextMenuActions(this.menuService, contextKeyService).forEach(actions => groups.push(actions));
|
||||
|
||||
groups.forEach(group => group.forEach(extensionAction => extensionAction.extension = this.extension));
|
||||
|
||||
@@ -757,6 +764,21 @@ export class ManageExtensionAction extends ExtensionDropDownAction {
|
||||
}
|
||||
}
|
||||
|
||||
export class MenuItemExtensionAction extends ExtensionAction {
|
||||
|
||||
constructor(private readonly action: IAction) {
|
||||
super(action.id, action.label);
|
||||
}
|
||||
|
||||
update() { }
|
||||
|
||||
async run(): Promise<void> {
|
||||
if (this.extension) {
|
||||
return this.action.run(this.extension.identifier.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class InstallAnotherVersionAction extends ExtensionAction {
|
||||
|
||||
static readonly ID = 'workbench.extensions.action.install.anotherVersion';
|
||||
@@ -809,89 +831,6 @@ export class InstallAnotherVersionAction extends ExtensionAction {
|
||||
}
|
||||
}
|
||||
|
||||
export class CopyExtensionInfoAction extends ExtensionAction {
|
||||
|
||||
static readonly ID = 'workbench.extensions.action.copyExtension';
|
||||
static readonly LABEL = localize('workbench.extensions.action.copyExtension', "Copy");
|
||||
|
||||
constructor(
|
||||
@IClipboardService private readonly clipboardService: IClipboardService
|
||||
) {
|
||||
super(CopyExtensionInfoAction.ID, CopyExtensionInfoAction.LABEL);
|
||||
this.update();
|
||||
}
|
||||
|
||||
update(): void {
|
||||
this.enabled = !!this.extension;
|
||||
}
|
||||
|
||||
async run(): Promise<any> {
|
||||
if (!this.extension) {
|
||||
return;
|
||||
}
|
||||
|
||||
const name = localize('extensionInfoName', 'Name: {0}', this.extension.displayName);
|
||||
const id = localize('extensionInfoId', 'Id: {0}', this.extension.identifier.id);
|
||||
const description = localize('extensionInfoDescription', 'Description: {0}', this.extension.description);
|
||||
const verision = localize('extensionInfoVersion', 'Version: {0}', this.extension.version);
|
||||
const publisher = localize('extensionInfoPublisher', 'Publisher: {0}', this.extension.publisherDisplayName);
|
||||
const link = this.extension.url ? localize('extensionInfoVSMarketplaceLink', 'VS Marketplace Link: {0}', this.extension.url.toString()) : null;
|
||||
|
||||
const clipboardStr = `${name}\n${id}\n${description}\n${verision}\n${publisher}${link ? '\n' + link : ''}`;
|
||||
|
||||
return this.clipboardService.writeText(clipboardStr);
|
||||
}
|
||||
}
|
||||
|
||||
export class CopyExtensionIdAction extends ExtensionAction {
|
||||
|
||||
static readonly ID = 'workbench.extensions.action.copyExtensionId';
|
||||
static readonly LABEL = localize('workbench.extensions.action.copyExtensionId', "Copy Extension Id");
|
||||
|
||||
constructor(
|
||||
@IClipboardService private readonly clipboardService: IClipboardService
|
||||
) {
|
||||
super(CopyExtensionIdAction.ID, CopyExtensionIdAction.LABEL);
|
||||
this.update();
|
||||
}
|
||||
|
||||
update(): void {
|
||||
this.enabled = !!this.extension;
|
||||
}
|
||||
|
||||
async run(): Promise<any> {
|
||||
if (!this.extension) {
|
||||
return;
|
||||
}
|
||||
return this.clipboardService.writeText(this.extension.identifier.id);
|
||||
}
|
||||
}
|
||||
|
||||
export class ExtensionSettingsAction extends ExtensionAction {
|
||||
|
||||
static readonly ID = 'extensions.extensionSettings';
|
||||
static readonly LABEL = localize('extensionSettingsAction', "Configure Extension Settings");
|
||||
|
||||
constructor(
|
||||
@IPreferencesService private readonly preferencesService: IPreferencesService
|
||||
) {
|
||||
super(ExtensionSettingsAction.ID, ExtensionSettingsAction.LABEL);
|
||||
this.update();
|
||||
}
|
||||
|
||||
update(): void {
|
||||
this.enabled = !!this.extension;
|
||||
}
|
||||
|
||||
async run(): Promise<any> {
|
||||
if (!this.extension) {
|
||||
return;
|
||||
}
|
||||
this.preferencesService.openSettings(false, `@ext:${this.extension.identifier.id}`);
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
export class EnableForWorkspaceAction extends ExtensionAction {
|
||||
|
||||
static readonly ID = 'extensions.enableForWorkspace';
|
||||
|
||||
@@ -57,6 +57,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { RemoteNameContext } from 'vs/workbench/browser/contextkeys';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { MementoObject } from 'vs/workbench/common/memento';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
|
||||
const NonEmptyWorkspaceContext = new RawContextKey<boolean>('nonEmptyWorkspace', false);
|
||||
const DefaultViewsContext = new RawContextKey<boolean>('defaultExtensionViews', true);
|
||||
@@ -130,7 +131,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: ExtensionsListView },
|
||||
ctorDescriptor: new SyncDescriptor(ExtensionsListView),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('searchMarketplaceExtensions')),
|
||||
weight: 100
|
||||
};
|
||||
@@ -143,7 +144,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: EnabledExtensionsView },
|
||||
ctorDescriptor: new SyncDescriptor(EnabledExtensionsView),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('defaultExtensionViews'), ContextKeyExpr.has('hasInstalledExtensions'), RemoteNameContext.isEqualTo('')),
|
||||
weight: 40,
|
||||
canToggleVisibility: true,
|
||||
@@ -158,7 +159,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: DisabledExtensionsView },
|
||||
ctorDescriptor: new SyncDescriptor(DisabledExtensionsView),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('defaultExtensionViews'), ContextKeyExpr.has('hasInstalledExtensions'), RemoteNameContext.isEqualTo('')),
|
||||
weight: 10,
|
||||
canToggleVisibility: true,
|
||||
@@ -175,7 +176,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: ExtensionsListView },
|
||||
ctorDescriptor: new SyncDescriptor(ExtensionsListView),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('defaultExtensionViews'), ContextKeyExpr.not('hasInstalledExtensions')),
|
||||
weight: 60,
|
||||
order: 1
|
||||
@@ -197,19 +198,19 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
return [{
|
||||
id: `extensions.${server.authority}.installed`,
|
||||
get name() { return getInstalledViewName(); },
|
||||
ctorDescriptor: { ctor: ServerExtensionsView, arguments: [server, EventOf.map<void, string>(onDidChangeServerLabel, () => getInstalledViewName())] },
|
||||
ctorDescriptor: new SyncDescriptor(ServerExtensionsView, [server, EventOf.map<void, string>(onDidChangeServerLabel, () => getInstalledViewName())]),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('searchInstalledExtensions')),
|
||||
weight: 100
|
||||
}, {
|
||||
id: `extensions.${server.authority}.outdated`,
|
||||
get name() { return getOutdatedViewName(); },
|
||||
ctorDescriptor: { ctor: ServerExtensionsView, arguments: [server, EventOf.map<void, string>(onDidChangeServerLabel, () => getOutdatedViewName())] },
|
||||
ctorDescriptor: new SyncDescriptor(ServerExtensionsView, [server, EventOf.map<void, string>(onDidChangeServerLabel, () => getOutdatedViewName())]),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('searchOutdatedExtensions')),
|
||||
weight: 100
|
||||
}, {
|
||||
id: `extensions.${server.authority}.default`,
|
||||
get name() { return getInstalledViewName(); },
|
||||
ctorDescriptor: { ctor: ServerExtensionsView, arguments: [server, EventOf.map<void, string>(onDidChangeServerLabel, () => getInstalledViewName())] },
|
||||
ctorDescriptor: new SyncDescriptor(ServerExtensionsView, [server, EventOf.map<void, string>(onDidChangeServerLabel, () => getInstalledViewName())]),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('defaultExtensionViews'), ContextKeyExpr.has('hasInstalledExtensions'), RemoteNameContext.notEqualsTo('')),
|
||||
weight: 40,
|
||||
order: 1
|
||||
@@ -224,7 +225,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: DefaultRecommendedExtensionsView },
|
||||
ctorDescriptor: new SyncDescriptor(DefaultRecommendedExtensionsView),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('defaultExtensionViews'), ContextKeyExpr.has('defaultRecommendedExtensions')),
|
||||
weight: 40,
|
||||
order: 2,
|
||||
@@ -239,7 +240,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: RecommendedExtensionsView },
|
||||
ctorDescriptor: new SyncDescriptor(RecommendedExtensionsView),
|
||||
when: ContextKeyExpr.has('recommendedExtensions'),
|
||||
weight: 50,
|
||||
order: 2
|
||||
@@ -253,7 +254,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: WorkspaceRecommendedExtensionsView },
|
||||
ctorDescriptor: new SyncDescriptor(WorkspaceRecommendedExtensionsView),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('recommendedExtensions'), ContextKeyExpr.has('nonEmptyWorkspace')),
|
||||
weight: 50,
|
||||
order: 1
|
||||
@@ -265,7 +266,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: EnabledExtensionsView },
|
||||
ctorDescriptor: new SyncDescriptor(EnabledExtensionsView),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('searchEnabledExtensions')),
|
||||
weight: 40,
|
||||
order: 1
|
||||
@@ -277,7 +278,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: DisabledExtensionsView },
|
||||
ctorDescriptor: new SyncDescriptor(DisabledExtensionsView),
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.has('searchDisabledExtensions')),
|
||||
weight: 10,
|
||||
order: 3,
|
||||
@@ -290,7 +291,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: BuiltInExtensionsView },
|
||||
ctorDescriptor: new SyncDescriptor(BuiltInExtensionsView),
|
||||
when: ContextKeyExpr.has('searchBuiltInExtensions'),
|
||||
weight: 100
|
||||
};
|
||||
@@ -301,7 +302,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: BuiltInThemesExtensionsView },
|
||||
ctorDescriptor: new SyncDescriptor(BuiltInThemesExtensionsView),
|
||||
when: ContextKeyExpr.has('searchBuiltInExtensions'),
|
||||
weight: 100
|
||||
};
|
||||
@@ -312,7 +313,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
|
||||
return {
|
||||
id,
|
||||
name: viewIdNameMappings[id],
|
||||
ctorDescriptor: { ctor: BuiltInBasicsExtensionsView },
|
||||
ctorDescriptor: new SyncDescriptor(BuiltInBasicsExtensionsView),
|
||||
when: ContextKeyExpr.has('searchBuiltInExtensions'),
|
||||
weight: 100
|
||||
};
|
||||
@@ -587,9 +588,8 @@ export class ExtensionsViewPaneContainer extends ViewPaneContainer implements IE
|
||||
if (this.configurationService.getValue<boolean>(CloseExtensionDetailsOnViewChangeKey)) {
|
||||
const promises = this.editorGroupService.groups.map(group => {
|
||||
const editors = group.editors.filter(input => input instanceof ExtensionsInput);
|
||||
const promises = editors.map(editor => group.closeEditor(editor));
|
||||
|
||||
return Promise.all(promises);
|
||||
return group.closeEditors(editors);
|
||||
});
|
||||
|
||||
Promise.all(promises);
|
||||
|
||||
@@ -28,7 +28,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { CountBadge } from 'vs/base/browser/ui/countBadge/countBadge';
|
||||
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { InstallWorkspaceRecommendedExtensionsAction, ConfigureWorkspaceFolderRecommendedExtensionsAction, ManageExtensionAction, InstallLocalExtensionsInRemoteAction } from 'vs/workbench/contrib/extensions/browser/extensionsActions';
|
||||
import { InstallWorkspaceRecommendedExtensionsAction, ConfigureWorkspaceFolderRecommendedExtensionsAction, ManageExtensionAction, InstallLocalExtensionsInRemoteAction, getContextMenuActions } from 'vs/workbench/contrib/extensions/browser/extensionsActions';
|
||||
import { WorkbenchPagedList } from 'vs/platform/list/browser/listService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
@@ -48,6 +48,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { SeverityIcon } from 'vs/platform/severityIcon/common/severityIcon';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import { IMenuService } from 'vs/platform/actions/common/actions';
|
||||
|
||||
// Extensions that are automatically classified as Programming Language extensions, but should be Feature extensions
|
||||
const FORCE_FEATURE_EXTENSIONS = ['vscode.git', 'vscode.search-result'];
|
||||
@@ -106,9 +107,10 @@ export class ExtensionsListView extends ViewPane {
|
||||
@IWorkbenchThemeService private readonly workbenchThemeService: IWorkbenchThemeService,
|
||||
@IExtensionManagementServerService protected readonly extensionManagementServerService: IExtensionManagementServerService,
|
||||
@IProductService protected readonly productService: IProductService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService,
|
||||
@IMenuService private readonly menuService: IMenuService,
|
||||
) {
|
||||
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title, showActionsAlways: true }, keybindingService, contextMenuService, configurationService, contextKeyService);
|
||||
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title, showActionsAlways: true }, keybindingService, contextMenuService, configurationService, contextKeyService, instantiationService);
|
||||
this.server = options.server;
|
||||
}
|
||||
|
||||
@@ -228,16 +230,27 @@ export class ExtensionsListView extends ViewPane {
|
||||
const fileIconThemes = await this.workbenchThemeService.getFileIconThemes();
|
||||
const manageExtensionAction = this.instantiationService.createInstance(ManageExtensionAction);
|
||||
manageExtensionAction.extension = e.element;
|
||||
const groups = manageExtensionAction.getActionGroups(runningExtensions, colorThemes, fileIconThemes);
|
||||
let actions: IAction[] = [];
|
||||
for (const menuActions of groups) {
|
||||
actions = [...actions, ...menuActions, new Separator()];
|
||||
}
|
||||
if (manageExtensionAction.enabled) {
|
||||
const groups = manageExtensionAction.getActionGroups(runningExtensions, colorThemes, fileIconThemes);
|
||||
let actions: IAction[] = [];
|
||||
for (const menuActions of groups) {
|
||||
actions = [...actions, ...menuActions, new Separator()];
|
||||
}
|
||||
this.contextMenuService.showContextMenu({
|
||||
getAnchor: () => e.anchor,
|
||||
getActions: () => actions.slice(0, actions.length - 1)
|
||||
});
|
||||
} else if (e.element) {
|
||||
const groups = getContextMenuActions(this.menuService, this.contextKeyService.createScoped());
|
||||
groups.forEach(group => group.forEach(extensionAction => extensionAction.extension = e.element!));
|
||||
let actions: IAction[] = [];
|
||||
for (const menuActions of groups) {
|
||||
actions = [...actions, ...menuActions, new Separator()];
|
||||
}
|
||||
this.contextMenuService.showContextMenu({
|
||||
getAnchor: () => e.anchor,
|
||||
getActions: () => actions
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -949,10 +962,11 @@ export class ServerExtensionsView extends ExtensionsListView {
|
||||
@IExtensionsWorkbenchService extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@IExtensionManagementServerService extensionManagementServerService: IExtensionManagementServerService,
|
||||
@IProductService productService: IProductService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IMenuService menuService: IMenuService,
|
||||
) {
|
||||
options.server = server;
|
||||
super(options, notificationService, keybindingService, contextMenuService, instantiationService, themeService, extensionService, extensionsWorkbenchService, editorService, tipsService, telemetryService, configurationService, contextService, experimentService, workbenchThemeService, extensionManagementServerService, productService, contextKeyService);
|
||||
super(options, notificationService, keybindingService, contextMenuService, instantiationService, themeService, extensionService, extensionsWorkbenchService, editorService, tipsService, telemetryService, configurationService, contextService, experimentService, workbenchThemeService, extensionManagementServerService, productService, contextKeyService, menuService);
|
||||
this._register(onDidChangeTitle(title => this.updateTitle(title)));
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
.extension-editor {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.extension-editor .clickable {
|
||||
@@ -188,7 +190,7 @@
|
||||
}
|
||||
|
||||
.extension-editor > .body {
|
||||
height: calc(100% - 168px);
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import { areSameExtensions } from 'vs/platform/extensionManagement/common/extens
|
||||
import { IExtensionManifest, ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IViewPaneContainer } from 'vs/workbench/common/viewPaneContainer';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
|
||||
export const VIEWLET_ID = 'workbench.view.extensions';
|
||||
|
||||
@@ -145,12 +144,3 @@ export class ExtensionContainers extends Disposable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface IExtensionMenuAction extends IAction {
|
||||
run(context: IExtensionMenuActionContext): Promise<void>;
|
||||
}
|
||||
|
||||
export interface IExtensionMenuActionContext {
|
||||
id: string;
|
||||
packageJSON: IExtensionManifest;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { TestContextService, TestSharedProcessService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { TestContextService, TestSharedProcessService, TestMenuService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ILogService, NullLogService } from 'vs/platform/log/common/log';
|
||||
import { URLService } from 'vs/platform/url/node/urlService';
|
||||
@@ -44,6 +44,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
|
||||
import { IMenuService } from 'vs/platform/actions/common/actions';
|
||||
|
||||
|
||||
suite('ExtensionsListView Tests', () => {
|
||||
@@ -92,7 +93,8 @@ suite('ExtensionsListView Tests', () => {
|
||||
instantiationService.stub(IExtensionManagementService, 'onUninstallExtension', uninstallEvent.event);
|
||||
instantiationService.stub(IExtensionManagementService, 'onDidUninstallExtension', didUninstallEvent.event);
|
||||
instantiationService.stub(IRemoteAgentService, RemoteAgentService);
|
||||
instantiationService.stub(IContextKeyService, MockContextKeyService);
|
||||
instantiationService.stub(IContextKeyService, new MockContextKeyService());
|
||||
instantiationService.stub(IMenuService, new TestMenuService());
|
||||
|
||||
instantiationService.stub(IExtensionManagementServerService, new class extends ExtensionManagementServerService {
|
||||
private _localExtensionManagementServer: IExtensionManagementServer = { extensionManagementService: instantiationService.get(IExtensionManagementService), label: 'local', authority: 'vscode-local' };
|
||||
|
||||
Reference in New Issue
Block a user