diff --git a/src/vs/workbench/contrib/debug/browser/debugCommands.ts b/src/vs/workbench/contrib/debug/browser/debugCommands.ts index 33f2b8f83c3..096a909b74a 100644 --- a/src/vs/workbench/contrib/debug/browser/debugCommands.ts +++ b/src/vs/workbench/contrib/debug/browser/debugCommands.ts @@ -10,7 +10,7 @@ import { KeybindingsRegistry, KeybindingWeight } from '../../../../platform/keyb import { IListService } from '../../../../platform/list/browser/listService.js'; import { IDebugService, IEnablement, CONTEXT_BREAKPOINTS_FOCUSED, CONTEXT_WATCH_EXPRESSIONS_FOCUSED, CONTEXT_VARIABLES_FOCUSED, EDITOR_CONTRIBUTION_ID, IDebugEditorContribution, CONTEXT_IN_DEBUG_MODE, CONTEXT_EXPRESSION_SELECTED, IConfig, IStackFrame, IThread, IDebugSession, CONTEXT_DEBUG_STATE, IDebugConfiguration, CONTEXT_JUMP_TO_CURSOR_SUPPORTED, REPL_VIEW_ID, CONTEXT_DEBUGGERS_AVAILABLE, State, getStateLabel, CONTEXT_BREAKPOINT_INPUT_FOCUSED, CONTEXT_FOCUSED_SESSION_IS_ATTACH, VIEWLET_ID, CONTEXT_DISASSEMBLY_VIEW_FOCUS, CONTEXT_IN_DEBUG_REPL, CONTEXT_STEP_INTO_TARGETS_SUPPORTED, isFrameDeemphasized } from '../common/debug.js'; import { Expression, Variable, Breakpoint, FunctionBreakpoint, DataBreakpoint, Thread } from '../common/debugModel.js'; -import { IExtensionsViewPaneContainer, VIEWLET_ID as EXTENSIONS_VIEWLET_ID } from '../../extensions/common/extensions.js'; +import { IExtensionsWorkbenchService } from '../../extensions/common/extensions.js'; import { ICodeEditor, isCodeEditor } from '../../../../editor/browser/editorBrowser.js'; import { MenuRegistry, MenuId, Action2, registerAction2 } from '../../../../platform/actions/common/actions.js'; import { IEditorService } from '../../../services/editor/common/editorService.js'; @@ -937,14 +937,12 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ when: undefined, primary: undefined, handler: async (accessor, query: string) => { - const paneCompositeService = accessor.get(IPaneCompositePartService); - const viewlet = (await paneCompositeService.openPaneComposite(EXTENSIONS_VIEWLET_ID, ViewContainerLocation.Sidebar, true))?.getViewPaneContainer() as IExtensionsViewPaneContainer; + const extensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService); let searchFor = `@category:debuggers`; if (typeof query === 'string') { searchFor += ` ${query}`; } - viewlet.search(searchFor); - viewlet.focus(); + return extensionsWorkbenchService.openSearch(searchFor); } }); diff --git a/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts b/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts index 4dc0f23670a..fba1ac91de1 100644 --- a/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts +++ b/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts @@ -61,8 +61,7 @@ import { ILocalizedString } from '../../../../platform/action/common/action.js'; import { Codicon } from '../../../../base/common/codicons.js'; import { CancellationError } from '../../../../base/common/errors.js'; import { IRemoteAgentService } from '../../../services/remote/common/remoteAgentService.js'; -import { IExtensionsViewPaneContainer, VIEWLET_ID } from '../../extensions/common/extensions.js'; -import { IPaneCompositePartService } from '../../../services/panecomposite/browser/panecomposite.js'; +import { IExtensionsWorkbenchService } from '../../extensions/common/extensions.js'; import { WorkspaceStateSynchroniser } from '../common/workspaceStateSync.js'; import { IUserDataProfilesService } from '../../../../platform/userDataProfile/common/userDataProfile.js'; import { IRequestService } from '../../../../platform/request/common/request.js'; @@ -101,10 +100,7 @@ registerAction2(class extends Action2 { } async run(accessor: ServicesAccessor): Promise { - const paneCompositePartService = accessor.get(IPaneCompositePartService); - const viewlet = await paneCompositePartService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true); - const view = viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer | undefined; - view?.search('@tag:continueOn'); + return accessor.get(IExtensionsWorkbenchService).openSearch('@tag:continueOn'); } }); diff --git a/src/vs/workbench/contrib/extensions/browser/deprecatedExtensionsChecker.ts b/src/vs/workbench/contrib/extensions/browser/deprecatedExtensionsChecker.ts index e6d5b02c2da..bf3d9421e15 100644 --- a/src/vs/workbench/contrib/extensions/browser/deprecatedExtensionsChecker.ts +++ b/src/vs/workbench/contrib/extensions/browser/deprecatedExtensionsChecker.ts @@ -8,8 +8,6 @@ import { IWorkbenchContribution } from '../../../common/contributions.js'; import { INotificationService, Severity } from '../../../../platform/notification/common/notification.js'; import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js'; import { localize } from '../../../../nls.js'; -import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js'; -import { SearchExtensionsAction } from './extensionsActions.js'; import { distinct } from '../../../../base/common/arrays.js'; import { Disposable } from '../../../../base/common/lifecycle.js'; import { IExtensionManagementService } from '../../../../platform/extensionManagement/common/extensionManagement.js'; @@ -24,7 +22,6 @@ export class DeprecatedExtensionsChecker extends Disposable implements IWorkbenc @IWorkbenchExtensionEnablementService private readonly extensionEnablementService: IWorkbenchExtensionEnablementService, @IStorageService private readonly storageService: IStorageService, @INotificationService private readonly notificationService: INotificationService, - @IInstantiationService private readonly instantiationService: IInstantiationService, ) { super(); this.checkForDeprecatedExtensions(); @@ -56,12 +53,7 @@ export class DeprecatedExtensionsChecker extends Disposable implements IWorkbenc label: localize('showDeprecated', "Show Deprecated Extensions"), run: async () => { this.setNotifiedDeprecatedExtensions(toNotify.map(e => e.identifier.id.toLowerCase())); - const action = this.instantiationService.createInstance(SearchExtensionsAction, toNotify.map(extension => `@id:${extension.identifier.id}`).join(' ')); - try { - await action.run(); - } finally { - action.dispose(); - } + await this.extensionsWorkbenchService.openSearch(toNotify.map(extension => `@id:${extension.identifier.id}`).join(' ')); } }, { label: localize('neverShowAgain', "Don't Show Again"), diff --git a/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts b/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts index 0aa9ed34913..a80cf76fe05 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts @@ -46,7 +46,6 @@ import { IColorTheme, ICssStyleCollector, IThemeService, registerThemingParticip import { IWorkspaceContextService } from '../../../../platform/workspace/common/workspace.js'; import { EditorPane } from '../../../browser/parts/editor/editorPane.js'; import { IEditorOpenContext } from '../../../common/editor.js'; -import { ViewContainerLocation } from '../../../common/views.js'; import { ExtensionFeaturesTab } from './extensionFeaturesTab.js'; import { ButtonWithDropDownExtensionAction, @@ -76,7 +75,7 @@ import { import { Delegate } from './extensionsList.js'; import { ExtensionData, ExtensionsGridView, ExtensionsTree, getExtensions } from './extensionsViewer.js'; import { ExtensionRecommendationWidget, ExtensionStatusWidget, ExtensionWidget, InstallCountWidget, RatingsWidget, RemoteBadgeWidget, SponsorWidget, VerifiedPublisherWidget, onClick } from './extensionsWidgets.js'; -import { ExtensionContainers, ExtensionEditorTab, ExtensionState, IExtension, IExtensionContainer, IExtensionsViewPaneContainer, IExtensionsWorkbenchService, VIEWLET_ID } from '../common/extensions.js'; +import { ExtensionContainers, ExtensionEditorTab, ExtensionState, IExtension, IExtensionContainer, IExtensionsWorkbenchService } from '../common/extensions.js'; import { ExtensionsInput, IExtensionEditorOptions } from '../common/extensionsInput.js'; import { IExplorerService } from '../../files/browser/files.js'; import { DEFAULT_MARKDOWN_STYLES, renderMarkdownDocument } from '../../markdown/browser/markdownDocumentRenderer.js'; @@ -85,7 +84,6 @@ import { IEditorGroup } from '../../../services/editor/common/editorGroupsServic import { IEditorService } from '../../../services/editor/common/editorService.js'; import { IExtensionRecommendationsService } from '../../../services/extensionRecommendations/common/extensionRecommendations.js'; import { IExtensionService } from '../../../services/extensions/common/extensions.js'; -import { IPaneCompositePartService } from '../../../services/panecomposite/browser/panecomposite.js'; import { IViewsService } from '../../../services/views/common/viewsService.js'; import { VIEW_ID as EXPLORER_VIEW_ID } from '../../files/common/files.js'; import { IUriIdentityService } from '../../../../platform/uriIdentity/common/uriIdentity.js'; @@ -240,7 +238,6 @@ export class ExtensionEditor extends EditorPane { group: IEditorGroup, @ITelemetryService telemetryService: ITelemetryService, @IInstantiationService private readonly instantiationService: IInstantiationService, - @IPaneCompositePartService private readonly paneCompositeService: IPaneCompositePartService, @IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService, @IExtensionGalleryService private readonly extensionGalleryService: IExtensionGalleryService, @IThemeService themeService: IThemeService, @@ -586,11 +583,7 @@ export class ExtensionEditor extends EditorPane { if (extension.url) { this.transientDisposables.add(onClick(template.name, () => this.openerService.open(URI.parse(extension.url!)))); this.transientDisposables.add(onClick(template.rating, () => this.openerService.open(URI.parse(`${extension.url}&ssr=false#review-details`)))); - this.transientDisposables.add(onClick(template.publisher, () => { - this.paneCompositeService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true) - .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) - .then(viewlet => viewlet.search(`publisher:"${extension.publisherDisplayName}"`)); - })); + this.transientDisposables.add(onClick(template.publisher, () => this.extensionsWorkbenchService.openSearch(`publisher:"${extension.publisherDisplayName}"`))); } const manifest = await this.extensionManifest.get().promise; @@ -944,11 +937,8 @@ export class ExtensionEditor extends EditorPane { append(categoriesContainer, $('.additional-details-title', undefined, localize('categories', "Categories"))); const categoriesElement = append(categoriesContainer, $('.categories')); for (const category of extension.categories) { - this.transientDisposables.add(onClick(append(categoriesElement, $('span.category', { tabindex: '0' }, category)), () => { - this.paneCompositeService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true) - .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) - .then(viewlet => viewlet.search(`@category:"${category}"`)); - })); + this.transientDisposables.add(onClick(append(categoriesElement, $('span.category', { tabindex: '0' }, category)), + () => this.extensionsWorkbenchService.openSearch(`@category:"${category}"`))); } } } diff --git a/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.ts b/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.ts index 45ef74f3bd5..1fc880f2465 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.ts @@ -3,13 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IAction } from '../../../../base/common/actions.js'; import { distinct } from '../../../../base/common/arrays.js'; import { CancelablePromise, createCancelablePromise, Promises, raceCancellablePromises, raceCancellation, timeout } from '../../../../base/common/async.js'; import { CancellationToken } from '../../../../base/common/cancellation.js'; import { isCancellationError } from '../../../../base/common/errors.js'; import { Emitter, Event } from '../../../../base/common/event.js'; -import { Disposable, DisposableStore, isDisposable, MutableDisposable, toDisposable } from '../../../../base/common/lifecycle.js'; +import { Disposable, DisposableStore, MutableDisposable, toDisposable } from '../../../../base/common/lifecycle.js'; import { isString } from '../../../../base/common/types.js'; import { URI } from '../../../../base/common/uri.js'; import { localize } from '../../../../nls.js'; @@ -17,13 +16,11 @@ import { IConfigurationService } from '../../../../platform/configuration/common import { IGalleryExtension } from '../../../../platform/extensionManagement/common/extensionManagement.js'; import { areSameExtensions } from '../../../../platform/extensionManagement/common/extensionManagementUtil.js'; import { IExtensionRecommendationNotificationService, IExtensionRecommendations, RecommendationsNotificationResult, RecommendationSource, RecommendationSourceToString } from '../../../../platform/extensionRecommendations/common/extensionRecommendations.js'; -import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js'; import { INotificationHandle, INotificationService, IPromptChoice, IPromptChoiceWithMenu, NotificationPriority, Severity } from '../../../../platform/notification/common/notification.js'; import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js'; import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js'; import { IUriIdentityService } from '../../../../platform/uriIdentity/common/uriIdentity.js'; import { IUserDataSyncEnablementService, SyncResource } from '../../../../platform/userDataSync/common/userDataSync.js'; -import { SearchExtensionsAction } from './extensionsActions.js'; import { IExtension, IExtensionsWorkbenchService } from '../common/extensions.js'; import { IWorkbenchEnvironmentService } from '../../../services/environment/common/environmentService.js'; import { EnablementState, IWorkbenchExtensionManagementService, IWorkbenchExtensionEnablementService } from '../../../services/extensionManagement/common/extensionManagement.js'; @@ -138,7 +135,6 @@ export class ExtensionRecommendationNotificationService extends Disposable imple @IStorageService private readonly storageService: IStorageService, @INotificationService private readonly notificationService: INotificationService, @ITelemetryService private readonly telemetryService: ITelemetryService, - @IInstantiationService private readonly instantiationService: IInstantiationService, @IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService, @IWorkbenchExtensionManagementService private readonly extensionManagementService: IWorkbenchExtensionManagementService, @IWorkbenchExtensionEnablementService private readonly extensionEnablementService: IWorkbenchExtensionEnablementService, @@ -282,7 +278,7 @@ export class ExtensionRecommendationNotificationService extends Disposable imple let accepted = false; const choices: (IPromptChoice | IPromptChoiceWithMenu)[] = []; const installExtensions = async (isMachineScoped: boolean) => { - this.runAction(this.instantiationService.createInstance(SearchExtensionsAction, searchValue)); + this.extensionsWorkbenchService.openSearch(searchValue); onDidInstallRecommendedExtensions(extensions); const galleryExtensions: IGalleryExtension[] = [], resourceExtensions: IExtension[] = []; for (const extension of extensions) { @@ -313,7 +309,7 @@ export class ExtensionRecommendationNotificationService extends Disposable imple for (const extension of extensions) { this.extensionsWorkbenchService.open(extension, { pinned: true }); } - this.runAction(this.instantiationService.createInstance(SearchExtensionsAction, searchValue)); + this.extensionsWorkbenchService.openSearch(searchValue); } }, { label: donotShowAgainLabel, @@ -464,16 +460,6 @@ export class ExtensionRecommendationNotificationService extends Disposable imple return result; } - private async runAction(action: IAction): Promise { - try { - await action.run(); - } finally { - if (isDisposable(action)) { - action.dispose(); - } - } - } - private addToImportantRecommendationsIgnore(id: string) { const importantRecommendationsIgnoreList = [...this.ignoredRecommendations]; if (!importantRecommendationsIgnoreList.includes(id.toLowerCase())) { diff --git a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts index b5dc1e178fc..6e7306a6186 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts @@ -14,7 +14,7 @@ import { IExtensionIgnoredRecommendationsService, IExtensionRecommendationsServi import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from '../../../common/contributions.js'; import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js'; import { VIEWLET_ID, IExtensionsWorkbenchService, IExtensionsViewPaneContainer, TOGGLE_IGNORE_EXTENSION_ACTION_ID, INSTALL_EXTENSION_FROM_VSIX_COMMAND_ID, WORKSPACE_RECOMMENDATIONS_VIEW_ID, IWorkspaceRecommendedExtensionsView, AutoUpdateConfigurationKey, HasOutdatedExtensionsContext, SELECT_INSTALL_VSIX_EXTENSION_COMMAND_ID, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID, ExtensionEditorTab, THEME_ACTIONS_GROUP, INSTALL_ACTIONS_GROUP, OUTDATED_EXTENSIONS_VIEW_ID, CONTEXT_HAS_GALLERY, IExtension, extensionsSearchActionsMenu, UPDATE_ACTIONS_GROUP, IExtensionArg, ExtensionRuntimeActionType } from '../common/extensions.js'; -import { ReinstallAction, InstallSpecificVersionOfExtensionAction, ConfigureWorkspaceRecommendedExtensionsAction, ConfigureWorkspaceFolderRecommendedExtensionsAction, PromptExtensionInstallFailureAction, SearchExtensionsAction, SetColorThemeAction, SetFileIconThemeAction, SetProductIconThemeAction, ClearLanguageAction, ToggleAutoUpdateForExtensionAction, ToggleAutoUpdatesForPublisherAction, TogglePreReleaseExtensionAction, InstallAnotherVersionAction, InstallAction } from './extensionsActions.js'; +import { ReinstallAction, InstallSpecificVersionOfExtensionAction, ConfigureWorkspaceRecommendedExtensionsAction, ConfigureWorkspaceFolderRecommendedExtensionsAction, PromptExtensionInstallFailureAction, SetColorThemeAction, SetFileIconThemeAction, SetProductIconThemeAction, ClearLanguageAction, ToggleAutoUpdateForExtensionAction, ToggleAutoUpdatesForPublisherAction, TogglePreReleaseExtensionAction, InstallAnotherVersionAction, InstallAction } from './extensionsActions.js'; import { ExtensionsInput } from '../common/extensionsInput.js'; import { ExtensionEditor } from './extensionEditor.js'; import { StatusUpdater, MaliciousExtensionChecker, ExtensionsViewletViewsContribution, ExtensionsViewPaneContainer, BuiltInExtensionsContext, SearchMarketplaceExtensionsContext, RecommendedExtensionsContext, DefaultViewsContext, ExtensionsSortByContext, SearchHasTextContext } from './extensionsViewlet.js'; @@ -68,7 +68,6 @@ import { WORKSPACE_TRUST_EXTENSION_SUPPORT } from '../../../services/workspaces/ import { ExtensionsCompletionItemsProvider } from './extensionsCompletionItemsProvider.js'; import { IQuickInputService } from '../../../../platform/quickinput/common/quickInput.js'; import { Event } from '../../../../base/common/event.js'; -import { IPaneCompositePartService } from '../../../services/panecomposite/browser/panecomposite.js'; import { UnsupportedExtensionsMigrationContrib } from './unsupportedExtensionsMigrationContribution.js'; import { isWeb } from '../../../../base/common/platform.js'; import { ExtensionStorageService } from '../../../../platform/extensionManagement/common/extensionStorage.js'; @@ -433,15 +432,7 @@ CommandsRegistry.registerCommand({ ] }, handler: async (accessor, query: string = '') => { - const paneCompositeService = accessor.get(IPaneCompositePartService); - const viewlet = await paneCompositeService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true); - - if (!viewlet) { - return; - } - - (viewlet.getViewPaneContainer() as IExtensionsViewPaneContainer).search(query); - viewlet.focus(); + return accessor.get(IExtensionsWorkbenchService).openSearch(query); } }); @@ -489,7 +480,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi @IExtensionManagementServerService private readonly extensionManagementServerService: IExtensionManagementServerService, @IExtensionGalleryService extensionGalleryService: IExtensionGalleryService, @IContextKeyService contextKeyService: IContextKeyService, - @IPaneCompositePartService private readonly paneCompositeService: IPaneCompositePartService, + @IViewsService private readonly viewsService: IViewsService, @IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService, @IWorkbenchExtensionEnablementService private readonly extensionEnablementService: IWorkbenchExtensionEnablementService, @IInstantiationService private readonly instantiationService: IInstantiationService, @@ -561,7 +552,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi category: ExtensionsLocalizedLabel, f1: true, run: async (accessor: ServicesAccessor) => { - await accessor.get(IPaneCompositePartService).openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true); + await accessor.get(IExtensionsWorkbenchService).openSearch(''); } }); @@ -593,7 +584,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi menuTitles: { [MenuId.EditorTitle.id]: localize('importKeyboardShortcutsFroms', "Migrate Keyboard Shortcuts from...") }, - run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@recommended:keymaps ')) + run: () => this.extensionsWorkbenchService.openSearch('@recommended:keymaps ') }); this.registerExtensionAction({ @@ -604,7 +595,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi id: MenuId.CommandPalette, when: CONTEXT_HAS_GALLERY }, - run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@recommended:languages ')) + run: () => this.extensionsWorkbenchService.openSearch('@recommended:languages ') }); this.registerExtensionAction({ @@ -624,7 +615,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi await this.extensionsWorkbenchService.checkForUpdates(); const outdated = this.extensionsWorkbenchService.outdated; if (outdated.length) { - return runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@outdated ')); + return this.extensionsWorkbenchService.openSearch('@outdated '); } else { return this.dialogService.info(localize('noUpdatesAvailable', "All extensions are up to date.")); } @@ -937,7 +928,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi menuTitles: { [extensionsFilterSubMenu.id]: localize('featured filter', "Featured") }, - run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@featured ')) + run: () => this.extensionsWorkbenchService.openSearch('@featured ') }); this.registerExtensionAction({ @@ -956,7 +947,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi menuTitles: { [extensionsFilterSubMenu.id]: localize('most popular filter', "Most Popular") }, - run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@popular ')) + run: () => this.extensionsWorkbenchService.openSearch('@popular ') }); this.registerExtensionAction({ @@ -975,7 +966,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi menuTitles: { [extensionsFilterSubMenu.id]: localize('most popular recommended', "Recommended") }, - run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@recommended ')) + run: () => this.extensionsWorkbenchService.openSearch('@recommended ') }); this.registerExtensionAction({ @@ -994,7 +985,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi menuTitles: { [extensionsFilterSubMenu.id]: localize('recently published filter', "Recently Published") }, - run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@recentlyPublished ')) + run: () => this.extensionsWorkbenchService.openSearch('@recentlyPublished ') }); const extensionsCategoryFilterSubMenu = new MenuId('extensionsCategoryFilterSubMenu'); @@ -1015,7 +1006,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi when: CONTEXT_HAS_GALLERY, order: index, }], - run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, `@category:"${category.toLowerCase()}"`)) + run: () => this.extensionsWorkbenchService.openSearch(`@category:"${category.toLowerCase()}"`) }); }); @@ -1034,7 +1025,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi menuTitles: { [extensionsFilterSubMenu.id]: localize('builtin filter', "Built-in") }, - run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@builtin ')) + run: () => this.extensionsWorkbenchService.openSearch('@builtin ') }); this.registerExtensionAction({ @@ -1052,7 +1043,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi menuTitles: { [extensionsFilterSubMenu.id]: localize('extension updates filter', "Updates") }, - run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@updates')) + run: () => this.extensionsWorkbenchService.openSearch('@updates') }); this.registerExtensionAction({ @@ -1071,7 +1062,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi menuTitles: { [extensionsFilterSubMenu.id]: localize('workspace unsupported filter', "Workspace Unsupported") }, - run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@workspaceUnsupported')) + run: () => this.extensionsWorkbenchService.openSearch('@workspaceUnsupported') }); this.registerExtensionAction({ @@ -1089,7 +1080,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi menuTitles: { [extensionsFilterSubMenu.id]: localize('enabled filter', "Enabled") }, - run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@enabled ')) + run: () => this.extensionsWorkbenchService.openSearch('@enabled ') }); this.registerExtensionAction({ @@ -1107,7 +1098,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi menuTitles: { [extensionsFilterSubMenu.id]: localize('disabled filter', "Disabled") }, - run: () => runAction(this.instantiationService.createInstance(SearchExtensionsAction, '@disabled ')) + run: () => this.extensionsWorkbenchService.openSearch('@disabled ') }); const extensionsSortSubMenu = new MenuId('extensionsSortSubMenu'); @@ -1137,11 +1128,10 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi }], toggled: ExtensionsSortByContext.isEqualTo(id), run: async () => { - const viewlet = await this.paneCompositeService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true); - const extensionsViewPaneContainer = viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer; - const currentQuery = Query.parse(extensionsViewPaneContainer.searchValue || ''); - extensionsViewPaneContainer.search(new Query(currentQuery.value, id).toString()); - extensionsViewPaneContainer.focus(); + const extensionsViewPaneContainer = ((await this.viewsService.openViewContainer(VIEWLET_ID, true))?.getViewPaneContainer()) as IExtensionsViewPaneContainer | undefined; + const currentQuery = Query.parse(extensionsViewPaneContainer?.searchValue ?? ''); + extensionsViewPaneContainer?.search(new Query(currentQuery.value, id).toString()); + extensionsViewPaneContainer?.focus(); } }); }); diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts index a263b5ba6f1..974c01deb12 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts @@ -12,7 +12,7 @@ import { Emitter, Event } from '../../../../base/common/event.js'; import * as json from '../../../../base/common/json.js'; import { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js'; import { disposeIfDisposable } from '../../../../base/common/lifecycle.js'; -import { IExtension, ExtensionState, IExtensionsWorkbenchService, VIEWLET_ID, IExtensionsViewPaneContainer, IExtensionContainer, TOGGLE_IGNORE_EXTENSION_ACTION_ID, SELECT_INSTALL_VSIX_EXTENSION_COMMAND_ID, THEME_ACTIONS_GROUP, INSTALL_ACTIONS_GROUP, UPDATE_ACTIONS_GROUP, ExtensionEditorTab, ExtensionRuntimeActionType, IExtensionArg, AutoUpdateConfigurationKey } from '../common/extensions.js'; +import { IExtension, ExtensionState, IExtensionsWorkbenchService, IExtensionContainer, TOGGLE_IGNORE_EXTENSION_ACTION_ID, SELECT_INSTALL_VSIX_EXTENSION_COMMAND_ID, THEME_ACTIONS_GROUP, INSTALL_ACTIONS_GROUP, UPDATE_ACTIONS_GROUP, ExtensionEditorTab, ExtensionRuntimeActionType, IExtensionArg, AutoUpdateConfigurationKey } from '../common/extensions.js'; import { ExtensionsConfigurationInitialContent } from '../common/extensionsFileTemplate.js'; import { IGalleryExtension, IExtensionGalleryService, ILocalExtension, InstallOptions, InstallOperation, TargetPlatformToString, ExtensionManagementErrorCode } from '../../../../platform/extensionManagement/common/extensionManagement.js'; import { IWorkbenchExtensionEnablementService, EnablementState, IExtensionManagementServerService, IExtensionManagementServer, IWorkbenchExtensionManagementService } from '../../../services/extensionManagement/common/extensionManagement.js'; @@ -60,8 +60,6 @@ import { IExtensionManifestPropertiesService } from '../../../services/extension import { IWorkspaceTrustEnablementService, IWorkspaceTrustManagementService } from '../../../../platform/workspace/common/workspaceTrust.js'; import { isVirtualWorkspace } from '../../../../platform/workspace/common/virtualWorkspace.js'; import { escapeMarkdownSyntaxTokens, IMarkdownString, MarkdownString } from '../../../../base/common/htmlContent.js'; -import { IPaneCompositePartService } from '../../../services/panecomposite/browser/panecomposite.js'; -import { ViewContainerLocation } from '../../../common/views.js'; import { fromNow } from '../../../../base/common/date.js'; import { IPreferencesService } from '../../../services/preferences/common/preferences.js'; import { getLocale } from '../../../../platform/languagePacks/common/languagePacks.js'; @@ -2015,7 +2013,6 @@ export class ShowRecommendedExtensionAction extends Action { constructor( extensionId: string, - @IPaneCompositePartService private readonly paneCompositeService: IPaneCompositePartService, @IExtensionsWorkbenchService private readonly extensionWorkbenchService: IExtensionsWorkbenchService, ) { super(ShowRecommendedExtensionAction.ID, ShowRecommendedExtensionAction.LABEL, undefined, false); @@ -2023,10 +2020,7 @@ export class ShowRecommendedExtensionAction extends Action { } override async run(): Promise { - const paneComposite = await this.paneCompositeService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true); - const paneContainer = paneComposite?.getViewPaneContainer() as IExtensionsViewPaneContainer; - paneContainer.search(`@id:${this.extensionId}`); - paneContainer.focus(); + await this.extensionWorkbenchService.openSearch(`@id:${this.extensionId}`); const [extension] = await this.extensionWorkbenchService.getExtensions([{ id: this.extensionId }], { source: 'install-recommendation' }, CancellationToken.None); if (extension) { return this.extensionWorkbenchService.open(extension); @@ -2044,7 +2038,6 @@ export class InstallRecommendedExtensionAction extends Action { constructor( extensionId: string, - @IPaneCompositePartService private readonly paneCompositeService: IPaneCompositePartService, @IInstantiationService private readonly instantiationService: IInstantiationService, @IExtensionsWorkbenchService private readonly extensionWorkbenchService: IExtensionsWorkbenchService, ) { @@ -2053,10 +2046,7 @@ export class InstallRecommendedExtensionAction extends Action { } override async run(): Promise { - const viewlet = await this.paneCompositeService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true); - const viewPaneContainer = viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer; - viewPaneContainer.search(`@id:${this.extensionId}`); - viewPaneContainer.focus(); + await this.extensionWorkbenchService.openSearch(`@id:${this.extensionId}`); const [extension] = await this.extensionWorkbenchService.getExtensions([{ id: this.extensionId }], { source: 'install-recommendation' }, CancellationToken.None); if (extension) { await this.extensionWorkbenchService.open(extension); @@ -2115,22 +2105,6 @@ export class UndoIgnoreExtensionRecommendationAction extends Action { } } -export class SearchExtensionsAction extends Action { - - constructor( - private readonly searchValue: string, - @IPaneCompositePartService private readonly paneCompositeService: IPaneCompositePartService - ) { - super('extensions.searchExtensions', localize('search recommendations', "Search Extensions"), undefined, true); - } - - override async run(): Promise { - const viewPaneContainer = (await this.paneCompositeService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true))?.getViewPaneContainer() as IExtensionsViewPaneContainer; - viewPaneContainer.search(this.searchValue); - viewPaneContainer.focus(); - } -} - export abstract class AbstractConfigureRecommendedExtensionsAction extends Action { constructor( @@ -2786,7 +2760,6 @@ export class ReinstallAction extends Action { @IQuickInputService private readonly quickInputService: IQuickInputService, @INotificationService private readonly notificationService: INotificationService, @IHostService private readonly hostService: IHostService, - @IInstantiationService private readonly instantiationService: IInstantiationService, @IExtensionService private readonly extensionService: IExtensionService ) { super(id, label); @@ -2819,7 +2792,7 @@ export class ReinstallAction extends Action { } private reinstallExtension(extension: IExtension): Promise { - return this.instantiationService.createInstance(SearchExtensionsAction, '@installed ').run() + return this.extensionsWorkbenchService.openSearch('@installed ') .then(() => { return this.extensionsWorkbenchService.reinstall(extension) .then(extension => { @@ -2865,7 +2838,7 @@ export class InstallSpecificVersionOfExtensionAction extends Action { if (extensionPick && extensionPick.extension) { const action = this.instantiationService.createInstance(InstallAnotherVersionAction, extensionPick.extension, true); await action.run(); - await this.instantiationService.createInstance(SearchExtensionsAction, extensionPick.extension.identifier.id).run(); + await this.extensionsWorkbenchService.openSearch(extensionPick.extension.identifier.id); } } @@ -3107,29 +3080,14 @@ export class InstallRemoteExtensionsInLocalAction extends AbstractInstallExtensi } CommandsRegistry.registerCommand('workbench.extensions.action.showExtensionsForLanguage', function (accessor: ServicesAccessor, fileExtension: string) { - const paneCompositeService = accessor.get(IPaneCompositePartService); - - return paneCompositeService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true) - .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) - .then(viewlet => { - viewlet.search(`ext:${fileExtension.replace(/^\./, '')}`); - viewlet.focus(); - }); + const extensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService); + return extensionsWorkbenchService.openSearch(`ext:${fileExtension.replace(/^\./, '')}`); }); export const showExtensionsWithIdsCommandId = 'workbench.extensions.action.showExtensionsWithIds'; CommandsRegistry.registerCommand(showExtensionsWithIdsCommandId, function (accessor: ServicesAccessor, extensionIds: string[]) { - const paneCompositeService = accessor.get(IPaneCompositePartService); - - return paneCompositeService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true) - .then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer) - .then(viewlet => { - const query = extensionIds - .map(id => `@id:${id}`) - .join(' '); - viewlet.search(query); - viewlet.focus(); - }); + const extensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService); + return extensionsWorkbenchService.openSearch(extensionIds.map(id => `@id:${id}`).join(' ')); }); registerColor('extensionButton.background', { diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.ts b/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.ts index 23eb15336fe..05166b41268 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.ts @@ -7,20 +7,18 @@ import { IQuickPickSeparator } from '../../../../platform/quickinput/common/quic import { IPickerQuickAccessItem, PickerQuickAccessProvider } from '../../../../platform/quickinput/browser/pickerQuickAccess.js'; import { CancellationToken } from '../../../../base/common/cancellation.js'; import { localize } from '../../../../nls.js'; -import { VIEWLET_ID, IExtensionsViewPaneContainer } from '../common/extensions.js'; import { IExtensionGalleryService, IExtensionManagementService, IGalleryExtension } from '../../../../platform/extensionManagement/common/extensionManagement.js'; import { INotificationService } from '../../../../platform/notification/common/notification.js'; import { ILogService } from '../../../../platform/log/common/log.js'; import { DisposableStore } from '../../../../base/common/lifecycle.js'; -import { IPaneCompositePartService } from '../../../services/panecomposite/browser/panecomposite.js'; -import { ViewContainerLocation } from '../../../common/views.js'; +import { IExtensionsWorkbenchService } from '../common/extensions.js'; export class InstallExtensionQuickAccessProvider extends PickerQuickAccessProvider { static PREFIX = 'ext install '; constructor( - @IPaneCompositePartService private readonly paneCompositeService: IPaneCompositePartService, + @IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService, @IExtensionGalleryService private readonly galleryService: IExtensionGalleryService, @IExtensionManagementService private readonly extensionsService: IExtensionManagementService, @INotificationService private readonly notificationService: INotificationService, @@ -40,7 +38,7 @@ export class InstallExtensionQuickAccessProvider extends PickerQuickAccessProvid const genericSearchPickItem: IPickerQuickAccessItem = { label: localize('searchFor', "Press Enter to search for extension '{0}'.", filter), - accept: () => this.searchExtension(filter) + accept: () => this.extensionsWorkbenchService.openSearch(filter) }; // Extension ID typed: try to find it @@ -80,37 +78,26 @@ export class InstallExtensionQuickAccessProvider extends PickerQuickAccessProvid private async installExtension(extension: IGalleryExtension, name: string): Promise { try { - await openExtensionsViewlet(this.paneCompositeService, `@id:${name}`); + await this.extensionsWorkbenchService.openSearch(`@id:${name}`); await this.extensionsService.installFromGallery(extension); } catch (error) { this.notificationService.error(error); } } - - private async searchExtension(name: string): Promise { - openExtensionsViewlet(this.paneCompositeService, name); - } } export class ManageExtensionsQuickAccessProvider extends PickerQuickAccessProvider { static PREFIX = 'ext '; - constructor(@IPaneCompositePartService private readonly paneCompositeService: IPaneCompositePartService) { + constructor(@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService) { super(ManageExtensionsQuickAccessProvider.PREFIX); } protected _getPicks(): Array { return [{ label: localize('manage', "Press Enter to manage your extensions."), - accept: () => openExtensionsViewlet(this.paneCompositeService) + accept: () => this.extensionsWorkbenchService.openSearch('') }]; } } - -async function openExtensionsViewlet(paneCompositeService: IPaneCompositePartService, search = ''): Promise { - const viewlet = await paneCompositeService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true); - const view = viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer | undefined; - view?.search(search); - view?.focus(); -} diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts b/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts index 08a136c6a60..d3deb35f309 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts @@ -25,7 +25,7 @@ import { IInstantiationService } from '../../../../platform/instantiation/common import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js'; import { IHostService } from '../../../services/host/browser/host.js'; import { URI } from '../../../../base/common/uri.js'; -import { IExtension, ExtensionState, IExtensionsWorkbenchService, AutoUpdateConfigurationKey, AutoCheckUpdatesConfigurationKey, HasOutdatedExtensionsContext, AutoUpdateConfigurationValue, InstallExtensionOptions, ExtensionRuntimeState, ExtensionRuntimeActionType, AutoRestartConfigurationKey } from '../common/extensions.js'; +import { IExtension, ExtensionState, IExtensionsWorkbenchService, AutoUpdateConfigurationKey, AutoCheckUpdatesConfigurationKey, HasOutdatedExtensionsContext, AutoUpdateConfigurationValue, InstallExtensionOptions, ExtensionRuntimeState, ExtensionRuntimeActionType, AutoRestartConfigurationKey, VIEWLET_ID, IExtensionsViewPaneContainer } from '../common/extensions.js'; import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from '../../../services/editor/common/editorService.js'; import { IURLService, IURLHandler, IOpenURLOptions } from '../../../../platform/url/common/url.js'; import { ExtensionsInput, IExtensionEditorOptions } from '../common/extensionsInput.js'; @@ -61,6 +61,7 @@ import { IWorkspaceContextService } from '../../../../platform/workspace/common/ import { ShowCurrentReleaseNotesActionId } from '../../update/common/update.js'; import { Registry } from '../../../../platform/registry/common/platform.js'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from '../../../../platform/configuration/common/configurationRegistry.js'; +import { IViewsService } from '../../../services/views/common/viewsService.js'; interface IExtensionStateProvider { (extension: Extension): T; @@ -947,6 +948,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension @IUpdateService private readonly updateService: IUpdateService, @IUriIdentityService private readonly uriIdentityService: IUriIdentityService, @IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService, + @IViewsService private readonly viewsService: IViewsService, ) { super(); const preferPreReleasesValue = configurationService.getValue('_extensions.preferPreReleases'); @@ -1389,6 +1391,14 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension await this.editorService.openEditor(this.instantiationService.createInstance(ExtensionsInput, extension), options, options?.sideByside ? SIDE_GROUP : ACTIVE_GROUP); } + async openSearch(searchValue: string, preserveFoucs?: boolean): Promise { + const viewPaneContainer = (await this.viewsService.openViewContainer(VIEWLET_ID, true))?.getViewPaneContainer() as IExtensionsViewPaneContainer; + viewPaneContainer.search(searchValue); + if (!preserveFoucs) { + viewPaneContainer.focus(); + } + } + getExtensionStatus(extension: IExtension): IExtensionsStatus | undefined { const extensionsStatus = this.extensionService.getExtensionsStatus(); for (const id of Object.keys(extensionsStatus)) { diff --git a/src/vs/workbench/contrib/extensions/common/extensions.ts b/src/vs/workbench/contrib/extensions/common/extensions.ts index 0d0ce95fbe3..4c5e1efa44c 100644 --- a/src/vs/workbench/contrib/extensions/common/extensions.ts +++ b/src/vs/workbench/contrib/extensions/common/extensions.ts @@ -141,6 +141,7 @@ export interface IExtensionsWorkbenchService { shouldRequireConsentToUpdate(extension: IExtension): Promise; updateAutoUpdateForAllExtensions(value: boolean): Promise; open(extension: IExtension | string, options?: IExtensionEditorOptions): Promise; + openSearch(searchValue: string, focus?: boolean): Promise; getAutoUpdateValue(): AutoUpdateConfigurationValue; checkForUpdates(): Promise; getExtensionStatus(extension: IExtension): IExtensionsStatus | undefined; diff --git a/src/vs/workbench/contrib/format/browser/formatActionsNone.ts b/src/vs/workbench/contrib/format/browser/formatActionsNone.ts index 8154ea44b41..a01e47e17c0 100644 --- a/src/vs/workbench/contrib/format/browser/formatActionsNone.ts +++ b/src/vs/workbench/contrib/format/browser/formatActionsNone.ts @@ -12,19 +12,10 @@ import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextke import { KeybindingWeight } from '../../../../platform/keybinding/common/keybindingsRegistry.js'; import { ICommandService } from '../../../../platform/commands/common/commands.js'; import { INotificationService } from '../../../../platform/notification/common/notification.js'; -import { VIEWLET_ID, IExtensionsViewPaneContainer } from '../../extensions/common/extensions.js'; +import { IExtensionsWorkbenchService } from '../../extensions/common/extensions.js'; import { IDialogService } from '../../../../platform/dialogs/common/dialogs.js'; -import { IPaneCompositePartService } from '../../../services/panecomposite/browser/panecomposite.js'; -import { ViewContainerLocation } from '../../../common/views.js'; import { ILanguageFeaturesService } from '../../../../editor/common/services/languageFeatures.js'; -async function showExtensionQuery(paneCompositeService: IPaneCompositePartService, query: string) { - const viewlet = await paneCompositeService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true); - if (viewlet) { - (viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer).search(query); - } -} - registerEditorAction(class FormatDocumentMultipleAction extends EditorAction { constructor() { @@ -48,7 +39,7 @@ registerEditorAction(class FormatDocumentMultipleAction extends EditorAction { } const commandService = accessor.get(ICommandService); - const paneCompositeService = accessor.get(IPaneCompositePartService); + const extensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService); const notificationService = accessor.get(INotificationService); const dialogService = accessor.get(IDialogService); const languageFeaturesService = accessor.get(ILanguageFeaturesService); @@ -70,7 +61,7 @@ registerEditorAction(class FormatDocumentMultipleAction extends EditorAction { primaryButton: nls.localize({ key: 'install.formatter', comment: ['&& denotes a mnemonic'] }, "&&Install Formatter...") }); if (confirmed) { - showExtensionQuery(paneCompositeService, `category:formatters ${langName}`); + extensionsWorkbenchService.openSearch(`category:formatters ${langName}`); } } } diff --git a/src/vs/workbench/contrib/localization/electron-sandbox/localization.contribution.ts b/src/vs/workbench/contrib/localization/electron-sandbox/localization.contribution.ts index 39795a322bf..9dfa4afa29a 100644 --- a/src/vs/workbench/contrib/localization/electron-sandbox/localization.contribution.ts +++ b/src/vs/workbench/contrib/localization/electron-sandbox/localization.contribution.ts @@ -12,12 +12,10 @@ import { IExtensionManagementService, IExtensionGalleryService, InstallOperation import { INotificationService, NeverShowAgainScope } from '../../../../platform/notification/common/notification.js'; import Severity from '../../../../base/common/severity.js'; import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js'; -import { VIEWLET_ID as EXTENSIONS_VIEWLET_ID, IExtensionsViewPaneContainer } from '../../extensions/common/extensions.js'; +import { IExtensionsWorkbenchService } from '../../extensions/common/extensions.js'; import { minimumTranslatedStrings } from './minimalTranslations.js'; import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js'; import { CancellationToken } from '../../../../base/common/cancellation.js'; -import { IPaneCompositePartService } from '../../../services/panecomposite/browser/panecomposite.js'; -import { ViewContainerLocation } from '../../../common/views.js'; import { ILocaleService } from '../../../services/localization/common/locale.js'; import { IProductService } from '../../../../platform/product/common/productService.js'; import { BaseLocalizationWorkbenchContribution } from '../common/localization.contribution.js'; @@ -32,7 +30,7 @@ class NativeLocalizationWorkbenchContribution extends BaseLocalizationWorkbenchC @IStorageService private readonly storageService: IStorageService, @IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService, @IExtensionGalleryService private readonly galleryService: IExtensionGalleryService, - @IPaneCompositePartService private readonly paneCompositeService: IPaneCompositePartService, + @IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService, @ITelemetryService private readonly telemetryService: ITelemetryService, ) { super(); @@ -168,16 +166,7 @@ class NativeLocalizationWorkbenchContribution extends BaseLocalizationWorkbenchC label: translations['searchMarketplace'], run: async () => { logUserReaction('search'); - const viewlet = await this.paneCompositeService.openPaneComposite(EXTENSIONS_VIEWLET_ID, ViewContainerLocation.Sidebar, true); - if (!viewlet) { - return; - } - const container = viewlet.getViewPaneContainer(); - if (!container) { - return; - } - (container as IExtensionsViewPaneContainer).search(`tag:lp-${locale}`); - container.focus(); + await this.extensionsWorkbenchService.openSearch(`tag:lp-${locale}`); } }; diff --git a/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.ts b/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.ts index 735bdad7d94..e561cf6e626 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.ts @@ -19,8 +19,7 @@ import { IInstantiationService } from '../../../../../../platform/instantiation/ import { IOpenerService } from '../../../../../../platform/opener/common/opener.js'; import { IQuickInputService, IQuickPickItem } from '../../../../../../platform/quickinput/common/quickInput.js'; import { ThemeIcon } from '../../../../../../base/common/themables.js'; -import { ViewContainerLocation } from '../../../../../common/views.js'; -import { IExtensionsViewPaneContainer, VIEWLET_ID as EXTENSION_VIEWLET_ID } from '../../../../extensions/common/extensions.js'; +import { IExtensionsWorkbenchService } from '../../../../extensions/common/extensions.js'; import { ICellOutputViewModel, ICellViewModel, IInsetRenderOutput, INotebookEditorDelegate, JUPYTER_EXTENSION_ID, RenderOutputType } from '../../notebookBrowser.js'; import { mimetypeIcon } from '../../notebookIcons.js'; import { CellContentPart } from '../cellPart.js'; @@ -31,7 +30,6 @@ import { CellUri, IOrderedMimeType, NotebookCellExecutionState, NotebookCellOutp import { INotebookExecutionStateService } from '../../../common/notebookExecutionStateService.js'; import { INotebookKernel } from '../../../common/notebookKernelService.js'; import { INotebookService } from '../../../common/notebookService.js'; -import { IPaneCompositePartService } from '../../../../../services/panecomposite/browser/panecomposite.js'; import { COPY_OUTPUT_COMMAND_ID } from '../../controller/cellOutputActions.js'; import { TEXT_BASED_MIMETYPES } from '../../contrib/clipboard/cellOutputClipboard.js'; import { autorun, observableValue } from '../../../../../../base/common/observable.js'; @@ -80,7 +78,7 @@ class CellOutputElement extends Disposable { @IQuickInputService private readonly quickInputService: IQuickInputService, @IContextKeyService parentContextKeyService: IContextKeyService, @IMenuService private readonly menuService: IMenuService, - @IPaneCompositePartService private readonly paneCompositeService: IPaneCompositePartService, + @IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService, @IInstantiationService private readonly instantiationService: IInstantiationService, ) { super(); @@ -430,9 +428,7 @@ class CellOutputElement extends Disposable { } private async _showJupyterExtension() { - const viewlet = await this.paneCompositeService.openPaneComposite(EXTENSION_VIEWLET_ID, ViewContainerLocation.Sidebar, true); - const view = viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer | undefined; - view?.search(`@id:${JUPYTER_EXTENSION_ID}`); + await this.extensionsWorkbenchService.openSearch(`@id:${JUPYTER_EXTENSION_ID}`); } private _generateRendererInfo(renderId: string): string { diff --git a/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.ts b/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.ts index 9acc12688d7..f14a7619562 100644 --- a/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.ts +++ b/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.ts @@ -22,15 +22,13 @@ import { IProductService } from '../../../../../platform/product/common/productS import { ProgressLocation } from '../../../../../platform/progress/common/progress.js'; import { IQuickInputButton, IQuickInputService, IQuickPick, IQuickPickItem, QuickPickInput } from '../../../../../platform/quickinput/common/quickInput.js'; import { ThemeIcon } from '../../../../../base/common/themables.js'; -import { ViewContainerLocation } from '../../../../common/views.js'; -import { IExtension, IExtensionsViewPaneContainer, IExtensionsWorkbenchService, VIEWLET_ID as EXTENSION_VIEWLET_ID } from '../../../extensions/common/extensions.js'; +import { IExtension, IExtensionsWorkbenchService } from '../../../extensions/common/extensions.js'; import { IActiveNotebookEditor, INotebookExtensionRecommendation, JUPYTER_EXTENSION_ID, KERNEL_RECOMMENDATIONS } from '../notebookBrowser.js'; import { NotebookEditorWidget } from '../notebookEditorWidget.js'; import { executingStateIcon, selectKernelIcon } from '../notebookIcons.js'; import { NotebookTextModel } from '../../common/model/notebookTextModel.js'; import { INotebookKernel, INotebookKernelHistoryService, INotebookKernelMatchResult, INotebookKernelService, ISourceAction } from '../../common/notebookKernelService.js'; import { IExtensionService } from '../../../../services/extensions/common/extensions.js'; -import { IPaneCompositePartService } from '../../../../services/panecomposite/browser/panecomposite.js'; import { URI } from '../../../../../base/common/uri.js'; import { IOpenerService } from '../../../../../platform/opener/common/opener.js'; import { INotebookTextModel } from '../../common/notebookCommon.js'; @@ -105,7 +103,6 @@ abstract class KernelPickerStrategyBase implements IKernelPickerStrategy { protected readonly _quickInputService: IQuickInputService, protected readonly _labelService: ILabelService, protected readonly _logService: ILogService, - protected readonly _paneCompositePartService: IPaneCompositePartService, protected readonly _extensionWorkbenchService: IExtensionsWorkbenchService, protected readonly _extensionService: IExtensionService, protected readonly _commandService: ICommandService @@ -255,7 +252,6 @@ abstract class KernelPickerStrategyBase implements IKernelPickerStrategy { // actions if (isSearchMarketplacePick(pick)) { await this._showKernelExtension( - this._paneCompositePartService, this._extensionWorkbenchService, this._extensionService, editor.textModel.viewType, @@ -264,7 +260,6 @@ abstract class KernelPickerStrategyBase implements IKernelPickerStrategy { // suggestedExtension must be defined for this option to be shown, but still check to make TS happy } else if (isInstallExtensionPick(pick)) { await this._showKernelExtension( - this._paneCompositePartService, this._extensionWorkbenchService, this._extensionService, editor.textModel.viewType, @@ -284,7 +279,6 @@ abstract class KernelPickerStrategyBase implements IKernelPickerStrategy { } protected async _showKernelExtension( - paneCompositePartService: IPaneCompositePartService, extensionWorkbenchService: IExtensionsWorkbenchService, extensionService: IExtensionService, viewType: string, @@ -337,10 +331,8 @@ abstract class KernelPickerStrategyBase implements IKernelPickerStrategy { return; } - const viewlet = await paneCompositePartService.openPaneComposite(EXTENSION_VIEWLET_ID, ViewContainerLocation.Sidebar, true); - const view = viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer | undefined; const pascalCased = viewType.split(/[^a-z0-9]/ig).map(uppercaseFirstLetter).join(''); - view?.search(`@tag:notebookKernel${pascalCased}`); + await extensionWorkbenchService.openSearch(`@tag:notebookKernel${pascalCased}`); } private async _showInstallKernelExtensionRecommendation( @@ -441,7 +433,6 @@ export class KernelPickerMRUStrategy extends KernelPickerStrategyBase { @IQuickInputService _quickInputService: IQuickInputService, @ILabelService _labelService: ILabelService, @ILogService _logService: ILogService, - @IPaneCompositePartService _paneCompositePartService: IPaneCompositePartService, @IExtensionsWorkbenchService _extensionWorkbenchService: IExtensionsWorkbenchService, @IExtensionService _extensionService: IExtensionService, @ICommandService _commandService: ICommandService, @@ -455,7 +446,6 @@ export class KernelPickerMRUStrategy extends KernelPickerStrategyBase { _quickInputService, _labelService, _logService, - _paneCompositePartService, _extensionWorkbenchService, _extensionService, _commandService, @@ -617,7 +607,6 @@ export class KernelPickerMRUStrategy extends KernelPickerStrategyBase { } } else if (isSearchMarketplacePick(selectedKernelPickItem)) { await this._showKernelExtension( - this._paneCompositePartService, this._extensionWorkbenchService, this._extensionService, editor.textModel.viewType, @@ -626,7 +615,6 @@ export class KernelPickerMRUStrategy extends KernelPickerStrategyBase { return true; } else if (isInstallExtensionPick(selectedKernelPickItem)) { await this._showKernelExtension( - this._paneCompositePartService, this._extensionWorkbenchService, this._extensionService, editor.textModel.viewType, diff --git a/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts b/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts index bf781d717da..101650b7dbd 100644 --- a/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts +++ b/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts @@ -30,12 +30,10 @@ import { getCodiconAriaLabel } from '../../../../base/common/iconLabels.js'; import { ILogService } from '../../../../platform/log/common/log.js'; import { ReloadWindowAction } from '../../../browser/actions/windowActions.js'; import { EXTENSION_INSTALL_SKIP_WALKTHROUGH_CONTEXT, IExtensionGalleryService, IExtensionManagementService } from '../../../../platform/extensionManagement/common/extensionManagement.js'; -import { IExtensionsViewPaneContainer, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID, VIEWLET_ID } from '../../extensions/common/extensions.js'; +import { IExtensionsWorkbenchService, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID } from '../../extensions/common/extensions.js'; import { ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js'; import { IMarkdownString, MarkdownString } from '../../../../base/common/htmlContent.js'; import { RemoteNameContext, VirtualWorkspaceContext } from '../../../common/contextkeys.js'; -import { IPaneCompositePartService } from '../../../services/panecomposite/browser/panecomposite.js'; -import { ViewContainerLocation } from '../../../common/views.js'; import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js'; import { WorkbenchActionExecutedClassification, WorkbenchActionExecutedEvent } from '../../../../base/common/actions.js'; import { KeybindingWeight } from '../../../../platform/keybinding/common/keybindingsRegistry.js'; @@ -227,13 +225,8 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr }); } run = (accessor: ServicesAccessor, input: string) => { - const paneCompositeService = accessor.get(IPaneCompositePartService); - return paneCompositeService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true).then(viewlet => { - if (viewlet) { - (viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer).search(`@recommended:remotes`); - viewlet.focus(); - } - }); + const extensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService); + return extensionsWorkbenchService.openSearch(`@recommended:remotes`); }; })); } diff --git a/src/vs/workbench/contrib/testing/browser/testExplorerActions.ts b/src/vs/workbench/contrib/testing/browser/testExplorerActions.ts index c5de8a8adaa..5557570e892 100644 --- a/src/vs/workbench/contrib/testing/browser/testExplorerActions.ts +++ b/src/vs/workbench/contrib/testing/browser/testExplorerActions.ts @@ -38,8 +38,7 @@ import { widgetClose } from '../../../../platform/theme/common/iconRegistry.js'; import { IUriIdentityService } from '../../../../platform/uriIdentity/common/uriIdentity.js'; import { ViewAction } from '../../../browser/parts/views/viewPane.js'; import { FocusedViewContext } from '../../../common/contextkeys.js'; -import { ViewContainerLocation } from '../../../common/views.js'; -import { VIEWLET_ID as EXTENSIONS_VIEWLET_ID, IExtensionsViewPaneContainer } from '../../extensions/common/extensions.js'; +import { IExtensionsWorkbenchService } from '../../extensions/common/extensions.js'; import { TestExplorerTreeElement, TestItemTreeElement } from './explorerProjections/index.js'; import * as icons from './icons.js'; import { TestingExplorerView } from './testingExplorerView.js'; @@ -58,7 +57,6 @@ import { ITestingContinuousRunService } from '../common/testingContinuousRunServ import { ITestingPeekOpener } from '../common/testingPeekOpener.js'; import { isFailedState } from '../common/testingStates.js'; import { IEditorService } from '../../../services/editor/common/editorService.js'; -import { IPaneCompositePartService } from '../../../services/panecomposite/browser/panecomposite.js'; import { IViewsService } from '../../../services/views/common/viewsService.js'; const category = Categories.Test; @@ -1556,10 +1554,7 @@ export class SearchForTestExtension extends Action2 { } public async run(accessor: ServicesAccessor) { - const paneCompositeService = accessor.get(IPaneCompositePartService); - const viewlet = (await paneCompositeService.openPaneComposite(EXTENSIONS_VIEWLET_ID, ViewContainerLocation.Sidebar, true))?.getViewPaneContainer() as IExtensionsViewPaneContainer; - viewlet.search('@category:"testing"'); - viewlet.focus(); + accessor.get(IExtensionsWorkbenchService).openSearch('@category:"testing"'); } } diff --git a/src/vs/workbench/contrib/themes/browser/themes.contribution.ts b/src/vs/workbench/contrib/themes/browser/themes.contribution.ts index b7a983ccd40..93599087f54 100644 --- a/src/vs/workbench/contrib/themes/browser/themes.contribution.ts +++ b/src/vs/workbench/contrib/themes/browser/themes.contribution.ts @@ -10,7 +10,7 @@ import { equalsIgnoreCase } from '../../../../base/common/strings.js'; import { Registry } from '../../../../platform/registry/common/platform.js'; import { Categories } from '../../../../platform/action/common/actionCommonCategories.js'; import { IWorkbenchThemeService, IWorkbenchTheme, ThemeSettingTarget, IWorkbenchColorTheme, IWorkbenchFileIconTheme, IWorkbenchProductIconTheme, ThemeSettings, ThemeSettingDefaults } from '../../../services/themes/common/workbenchThemeService.js'; -import { VIEWLET_ID, IExtensionsViewPaneContainer } from '../../extensions/common/extensions.js'; +import { IExtensionsWorkbenchService } from '../../extensions/common/extensions.js'; import { IExtensionGalleryService, IExtensionManagementService, IGalleryExtension } from '../../../../platform/extensionManagement/common/extensionManagement.js'; import { IColorRegistry, Extensions as ColorRegistryExtensions } from '../../../../platform/theme/common/colorRegistry.js'; import { IEditorService } from '../../../services/editor/common/editorService.js'; @@ -20,8 +20,6 @@ import { colorThemeSchemaId } from '../../../services/themes/common/colorThemeSc import { isCancellationError, onUnexpectedError } from '../../../../base/common/errors.js'; import { IQuickInputButton, IQuickInputService, IQuickInputToggle, IQuickPick, IQuickPickItem, QuickPickInput } from '../../../../platform/quickinput/common/quickInput.js'; import { DEFAULT_PRODUCT_ICON_THEME_ID, ProductIconThemeData } from '../../../services/themes/browser/productIconThemeData.js'; -import { IPaneCompositePartService } from '../../../services/panecomposite/browser/panecomposite.js'; -import { ViewContainerLocation } from '../../../common/views.js'; import { ThrottledDelayer } from '../../../../base/common/async.js'; import { CancellationToken, CancellationTokenSource } from '../../../../base/common/cancellation.js'; import { ILogService } from '../../../../platform/log/common/log.js'; @@ -81,7 +79,7 @@ class MarketplaceThemesPicker { @IQuickInputService private readonly quickInputService: IQuickInputService, @ILogService private readonly logService: ILogService, @IProgressService private readonly progressService: IProgressService, - @IPaneCompositePartService private readonly paneCompositeService: IPaneCompositePartService, + @IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService, @IDialogService private readonly dialogService: IDialogService ) { this._installedExtensions = extensionManagementService.getInstalled().then(installed => { @@ -197,9 +195,9 @@ class MarketplaceThemesPicker { if (isItem(e.item)) { const extensionId = e.item.theme?.extensionData?.extensionId; if (extensionId) { - openExtensionViewlet(this.paneCompositeService, `@id:${extensionId}`); + this.extensionsWorkbenchService.openSearch(`@id:${extensionId}`); } else { - openExtensionViewlet(this.paneCompositeService, `${this.marketplaceQuery} ${quickpick.value}`); + this.extensionsWorkbenchService.openSearch(`${this.marketplaceQuery} ${quickpick.value}`); } } })); @@ -248,7 +246,7 @@ class MarketplaceThemesPicker { } private async installExtension(galleryExtension: IGalleryExtension) { - openExtensionViewlet(this.paneCompositeService, `@id:${galleryExtension.identifier.id}`); + this.extensionsWorkbenchService.openSearch(`@id:${galleryExtension.identifier.id}`); const result = await this.dialogService.confirm({ message: localize('installExtension.confirm', "This will install extension '{0}' published by '{1}'. Do you want to continue?", galleryExtension.displayName, galleryExtension.publisherDisplayName), primaryButton: localize('installExtension.button.ok', "OK") @@ -303,7 +301,7 @@ class InstalledThemesPicker { private readonly getMarketplaceColorThemes: (publisher: string, name: string, version: string) => Promise, @IQuickInputService private readonly quickInputService: IQuickInputService, @IExtensionGalleryService private readonly extensionGalleryService: IExtensionGalleryService, - @IPaneCompositePartService private readonly paneCompositeService: IPaneCompositePartService, + @IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService, @IExtensionResourceLoaderService private readonly extensionResourceLoaderService: IExtensionResourceLoaderService, @IInstantiationService private readonly instantiationService: IInstantiationService ) { @@ -361,7 +359,7 @@ class InstalledThemesPicker { const theme = quickpick.selectedItems[0]; if (!theme || theme.configureItem) { // 'pick in marketplace' entry if (!theme || theme.configureItem === ConfigureItem.EXTENSIONS_VIEW) { - openExtensionViewlet(this.paneCompositeService, `${this.options.marketplaceTag} ${quickpick.value}`); + this.extensionsWorkbenchService.openSearch(`${this.options.marketplaceTag} ${quickpick.value}`); } else if (theme.configureItem === ConfigureItem.BROWSE_GALLERY) { if (marketplaceThemePicker) { const res = await marketplaceThemePicker.openQuickPick(quickpick.value, currentTheme, selectTheme); @@ -389,9 +387,9 @@ class InstalledThemesPicker { if (isItem(e.item)) { const extensionId = e.item.theme?.extensionData?.extensionId; if (extensionId) { - openExtensionViewlet(this.paneCompositeService, `@id:${extensionId}`); + this.extensionsWorkbenchService.openSearch(`@id:${extensionId}`); } else { - openExtensionViewlet(this.paneCompositeService, `${this.options.marketplaceTag} ${quickpick.value}`); + this.extensionsWorkbenchService.openSearch(`${this.options.marketplaceTag} ${quickpick.value}`); } } })); @@ -606,14 +604,6 @@ function configurationEntry(label: string, configureItem: ConfigureItem): QuickP }; } -function openExtensionViewlet(paneCompositeService: IPaneCompositePartService, query: string) { - return paneCompositeService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true).then(viewlet => { - if (viewlet) { - (viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer).search(query); - viewlet.focus(); - } - }); -} interface ThemeItem extends IQuickPickItem { readonly id: string | undefined; readonly theme?: IWorkbenchTheme;