Skip to content

Commit 9c1a7e7

Browse files
committed
Show disabled extensions action
1 parent f6e01e3 commit 9c1a7e7

3 files changed

Lines changed: 41 additions & 7 deletions

File tree

src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/co
2020
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
2121
import { VIEWLET_ID, IExtensionsWorkbenchService } from './extensions';
2222
import { ExtensionsWorkbenchService } from './extensionsWorkbenchService';
23-
import { OpenExtensionsViewletAction, InstallExtensionsAction, ShowOutdatedExtensionsAction, ShowRecommendedExtensionsAction, ShowWorkspaceRecommendedExtensionsAction, ShowPopularExtensionsAction, ShowInstalledExtensionsAction, UpdateAllAction, OpenExtensionsFolderAction, ConfigureWorkspaceRecommendedExtensionsAction, OpenWorkspaceExtensionsStorageFile, OpenGlobalExtensionsStorageFile, InstallVSIXAction } from './extensionsActions';
23+
import { OpenExtensionsViewletAction, InstallExtensionsAction, ShowOutdatedExtensionsAction, ShowRecommendedExtensionsAction, ShowWorkspaceRecommendedExtensionsAction, ShowPopularExtensionsAction, ShowInstalledExtensionsAction, ShowDisabledExtensionsAction, UpdateAllAction, OpenExtensionsFolderAction, ConfigureWorkspaceRecommendedExtensionsAction, OpenWorkspaceExtensionsStorageFile, OpenGlobalExtensionsStorageFile, InstallVSIXAction } from './extensionsActions';
2424
import { ExtensionsInput } from './extensionsInput';
2525
import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet';
2626
import { ExtensionEditor } from './extensionEditor';
@@ -110,6 +110,9 @@ actionRegistry.registerWorkbenchAction(popularActionDescriptor, 'Extensions: Sho
110110
const installedActionDescriptor = new SyncActionDescriptor(ShowInstalledExtensionsAction, ShowInstalledExtensionsAction.ID, ShowInstalledExtensionsAction.LABEL);
111111
actionRegistry.registerWorkbenchAction(installedActionDescriptor, 'Extensions: Show Installed Extensions', ExtensionsLabel);
112112

113+
const disabledActionDescriptor = new SyncActionDescriptor(ShowDisabledExtensionsAction, ShowDisabledExtensionsAction.ID, ShowDisabledExtensionsAction.LABEL);
114+
actionRegistry.registerWorkbenchAction(disabledActionDescriptor, 'Extensions: Show Disabled Extensions', ExtensionsLabel);
115+
113116
const updateAllActionDescriptor = new SyncActionDescriptor(UpdateAllAction, UpdateAllAction.ID, UpdateAllAction.LABEL);
114117
actionRegistry.registerWorkbenchAction(updateAllActionDescriptor, 'Extensions: Update All Extensions', ExtensionsLabel);
115118

@@ -119,11 +122,11 @@ actionRegistry.registerWorkbenchAction(openExtensionsFolderActionDescriptor, 'Ex
119122
const openExtensionsFileActionDescriptor = new SyncActionDescriptor(ConfigureWorkspaceRecommendedExtensionsAction, ConfigureWorkspaceRecommendedExtensionsAction.ID, ConfigureWorkspaceRecommendedExtensionsAction.LABEL);
120123
actionRegistry.registerWorkbenchAction(openExtensionsFileActionDescriptor, 'Extensions: Open Extensions File', ExtensionsLabel);
121124

122-
const disableExtensionsActionDescriptor = new SyncActionDescriptor(OpenGlobalExtensionsStorageFile, OpenGlobalExtensionsStorageFile.ID, localize('disableGlobalExtensions', "Disable Extensions"));
123-
actionRegistry.registerWorkbenchAction(disableExtensionsActionDescriptor, 'Extensions: Disable Extensions', ExtensionsLabel);
125+
const disableExtensionsActionDescriptor = new SyncActionDescriptor(OpenGlobalExtensionsStorageFile, OpenGlobalExtensionsStorageFile.ID, localize('disableGlobalExtensions', "Configure Disabled Extensions"));
126+
actionRegistry.registerWorkbenchAction(disableExtensionsActionDescriptor, 'Extensions: Configure Disabled Extensions', ExtensionsLabel);
124127

125-
const disableWorkspaceExtensionsActionDescriptor = new SyncActionDescriptor(OpenWorkspaceExtensionsStorageFile, OpenWorkspaceExtensionsStorageFile.ID, localize('disableWorkspaceExtensions', "Disable Extensions (Workspace)"));
126-
actionRegistry.registerWorkbenchAction(disableWorkspaceExtensionsActionDescriptor, 'Extensions: Disable Extensions (Workspace)', ExtensionsLabel);
128+
const disableWorkspaceExtensionsActionDescriptor = new SyncActionDescriptor(OpenWorkspaceExtensionsStorageFile, OpenWorkspaceExtensionsStorageFile.ID, localize('disableWorkspaceExtensions', "Configure Disabled Extensions (Workspace)"));
129+
actionRegistry.registerWorkbenchAction(disableWorkspaceExtensionsActionDescriptor, 'Extensions: Configure Disabled Extensions (Workspace)', ExtensionsLabel);
127130

128131
const installVSIXActionDescriptor = new SyncActionDescriptor(InstallVSIXAction, InstallVSIXAction.ID, InstallVSIXAction.LABEL);
129132
actionRegistry.registerWorkbenchAction(installVSIXActionDescriptor, 'Extensions: Install from VSIX...', ExtensionsLabel);

src/vs/workbench/parts/extensions/electron-browser/extensionsActions.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,30 @@ export class ShowInstalledExtensionsAction extends Action {
381381
}
382382
}
383383

384+
export class ShowDisabledExtensionsAction extends Action {
385+
386+
static ID = 'workbench.extensions.action.showDisabledExtensions';
387+
static LABEL = localize('showDisabledExtensions', "Show Disabled Extensions");
388+
389+
constructor(
390+
id: string,
391+
label: string,
392+
@IViewletService private viewletService: IViewletService,
393+
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService
394+
) {
395+
super(id, label, 'null', true);
396+
}
397+
398+
run(): TPromise<void> {
399+
return this.viewletService.openViewlet(VIEWLET_ID, true)
400+
.then(viewlet => viewlet as IExtensionsViewlet)
401+
.then(viewlet => {
402+
viewlet.search('@disabled ');
403+
viewlet.focus();
404+
});
405+
}
406+
}
407+
384408
export class ClearExtensionsInputAction extends ShowInstalledExtensionsAction {
385409

386410
static ID = 'workbench.extensions.action.clearExtensionsInput';
@@ -590,7 +614,7 @@ export class OpenExtensionsFolderAction extends Action {
590614
export class ConfigureWorkspaceRecommendedExtensionsAction extends Action {
591615

592616
static ID = 'workbench.extensions.action.configureWorkspaceRecommendedExtensions';
593-
static LABEL = localize('configureWorkspaceRecommendedExtensions', "Configure Workspace Recommended Extensions");
617+
static LABEL = localize('configureWorkspaceRecommendedExtensions', "Configure Recommended Extensions (Workspace)");
594618

595619
constructor(
596620
id: string,

src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { PagedList } from 'vs/base/browser/ui/list/listPaging';
3030
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
3131
import { Delegate, Renderer } from './extensionsList';
3232
import { IExtensionsWorkbenchService, IExtension, IExtensionsViewlet, VIEWLET_ID, ExtensionState } from './extensions';
33-
import { ShowRecommendedExtensionsAction, ShowWorkspaceRecommendedExtensionsAction, ShowPopularExtensionsAction, ShowInstalledExtensionsAction, ShowOutdatedExtensionsAction, ClearExtensionsInputAction, ChangeSortAction, UpdateAllAction, InstallVSIXAction, ConfigureWorkspaceRecommendedExtensionsAction } from './extensionsActions';
33+
import { ShowRecommendedExtensionsAction, ShowWorkspaceRecommendedExtensionsAction, ShowPopularExtensionsAction, ShowInstalledExtensionsAction, ShowDisabledExtensionsAction, ShowOutdatedExtensionsAction, ClearExtensionsInputAction, ChangeSortAction, UpdateAllAction, InstallVSIXAction, ConfigureWorkspaceRecommendedExtensionsAction } from './extensionsActions';
3434
import { IExtensionManagementService, IExtensionGalleryService, IExtensionTipsService, SortBy, SortOrder, IQueryOptions, LocalExtensionType } from 'vs/platform/extensionManagement/common/extensionManagement';
3535
import { ExtensionsInput } from './extensionsInput';
3636
import { Query } from '../common/extensionQuery';
@@ -163,6 +163,7 @@ export class ExtensionsViewlet extends Viewlet implements IExtensionsViewlet {
163163
new Separator(),
164164
this.instantiationService.createInstance(ShowInstalledExtensionsAction, ShowInstalledExtensionsAction.ID, ShowInstalledExtensionsAction.LABEL),
165165
this.instantiationService.createInstance(ShowOutdatedExtensionsAction, ShowOutdatedExtensionsAction.ID, ShowOutdatedExtensionsAction.LABEL),
166+
this.instantiationService.createInstance(ShowDisabledExtensionsAction, ShowDisabledExtensionsAction.ID, ShowDisabledExtensionsAction.LABEL),
166167
this.instantiationService.createInstance(ShowRecommendedExtensionsAction, ShowRecommendedExtensionsAction.ID, ShowRecommendedExtensionsAction.LABEL),
167168
this.instantiationService.createInstance(ShowWorkspaceRecommendedExtensionsAction, ShowWorkspaceRecommendedExtensionsAction.ID, ShowWorkspaceRecommendedExtensionsAction.LABEL),
168169
this.instantiationService.createInstance(ShowPopularExtensionsAction, ShowPopularExtensionsAction.ID, ShowPopularExtensionsAction.LABEL),
@@ -233,6 +234,12 @@ export class ExtensionsViewlet extends Viewlet implements IExtensionsViewlet {
233234
.then(result => new PagedModel(result));
234235
}
235236

237+
if (/@disabled/i.test(value)) {
238+
return this.extensionsWorkbenchService.queryLocal()
239+
.then(result => result.filter(e => e.disabled))
240+
.then(result => new PagedModel(result));
241+
}
242+
236243
const query = Query.parse(value);
237244
let options: IQueryOptions = {};
238245

0 commit comments

Comments
 (0)