diff --git a/packages/vsx-registry/src/browser/vsx-extensions-contribution.ts b/packages/vsx-registry/src/browser/vsx-extensions-contribution.ts index 6defaeb2c6f7d..3de7c4c513c65 100644 --- a/packages/vsx-registry/src/browser/vsx-extensions-contribution.ts +++ b/packages/vsx-registry/src/browser/vsx-extensions-contribution.ts @@ -31,7 +31,7 @@ import { LabelProvider, PreferenceService } from '@theia/core/lib/browser'; import { VscodeCommands } from '@theia/plugin-ext-vscode/lib/browser/plugin-vscode-commands-contribution'; import { VSXExtensionsContextMenu, VSXExtension } from './vsx-extension'; import { ClipboardService } from '@theia/core/lib/browser/clipboard-service'; -import { RECOMMENDED_QUERY } from './vsx-extensions-search-model'; +import { BUILTIN_QUERY, INSTALLED_QUERY, RECOMMENDED_QUERY } from './vsx-extensions-search-model'; import { IGNORE_RECOMMENDATIONS_ID } from './recommended-extensions/recommended-extensions-preference-contribution'; export namespace VSXExtensionsCommands { @@ -56,6 +56,16 @@ export namespace VSXExtensionsCommands { export const COPY_EXTENSION_ID: Command = { id: 'vsxExtensions.copyExtensionId' }; + export const SHOW_BUILTINS: Command = { + id: 'vsxExtension.showBuiltins', + label: 'Show Built-in Extensions', + category: EXTENSIONS_CATEGORY, + }; + export const SHOW_INSTALLED: Command = { + id: 'vsxExtension.showInstalled', + label: 'Show Installed Extensions', + category: EXTENSIONS_CATEGORY, + }; export const SHOW_RECOMMENDATIONS: Command = { id: 'vsxExtension.showRecommendations', label: 'Show Recommended Extensions', @@ -121,6 +131,14 @@ export class VSXExtensionsContribution extends AbstractViewContribution this.copyExtensionId(extension) }); + commands.registerCommand(VSXExtensionsCommands.SHOW_BUILTINS, { + execute: () => this.showBuiltinExtensions() + }); + + commands.registerCommand(VSXExtensionsCommands.SHOW_INSTALLED, { + execute: () => this.showInstalledExtensions() + }); + commands.registerCommand(VSXExtensionsCommands.SHOW_RECOMMENDATIONS, { execute: () => this.showRecommendedExtensions() }); @@ -263,6 +281,16 @@ export class VSXExtensionsContribution extends AbstractViewContribution { + await this.openView({ activate: true }); + this.model.search.query = BUILTIN_QUERY; + } + + protected async showInstalledExtensions(): Promise { + await this.openView({ activate: true }); + this.model.search.query = INSTALLED_QUERY; + } + protected async showRecommendedExtensions(): Promise { await this.openView({ activate: true }); this.model.search.query = RECOMMENDED_QUERY; diff --git a/packages/vsx-registry/src/browser/vsx-extensions-search-model.ts b/packages/vsx-registry/src/browser/vsx-extensions-search-model.ts index 741accdf02e50..c530ab3cbb564 100644 --- a/packages/vsx-registry/src/browser/vsx-extensions-search-model.ts +++ b/packages/vsx-registry/src/browser/vsx-extensions-search-model.ts @@ -21,9 +21,13 @@ export enum VSXSearchMode { Initial, None, Search, + Installed, + Builtin, Recommended, } +export const BUILTIN_QUERY = '@builtin'; +export const INSTALLED_QUERY = '@installed'; export const RECOMMENDED_QUERY = '@recommended'; @injectable() @@ -32,7 +36,9 @@ export class VSXExtensionsSearchModel { protected readonly onDidChangeQueryEmitter = new Emitter(); readonly onDidChangeQuery = this.onDidChangeQueryEmitter.event; protected readonly specialQueries = new Map([ - [RECOMMENDED_QUERY, VSXSearchMode.Recommended] + [BUILTIN_QUERY, VSXSearchMode.Builtin], + [INSTALLED_QUERY, VSXSearchMode.Installed], + [RECOMMENDED_QUERY, VSXSearchMode.Recommended], ]); protected _query = ''; diff --git a/packages/vsx-registry/src/browser/vsx-extensions-view-container.ts b/packages/vsx-registry/src/browser/vsx-extensions-view-container.ts index 27a3cb89482c0..1d1037528b538 100644 --- a/packages/vsx-registry/src/browser/vsx-extensions-view-container.ts +++ b/packages/vsx-registry/src/browser/vsx-extensions-view-container.ts @@ -117,6 +117,10 @@ export class VSXExtensionsViewContainer extends ViewContainer { protected getWidgetsForMode(): string[] { switch (this.currentMode) { + case VSXSearchMode.Builtin: + return [generateExtensionWidgetId(VSXExtensionsSourceOptions.BUILT_IN)]; + case VSXSearchMode.Installed: + return [generateExtensionWidgetId(VSXExtensionsSourceOptions.INSTALLED)]; case VSXSearchMode.Recommended: return [generateExtensionWidgetId(VSXExtensionsSourceOptions.RECOMMENDED)]; case VSXSearchMode.Search: