From 23bc47dbab2e15026de8f7698efbfb1e9b2a42cf Mon Sep 17 00:00:00 2001 From: Matt Bierner <12821956+mjbvz@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:28:59 -0800 Subject: [PATCH] Don't return providers in IChatSessionsService Further trying to clean up interface so that `IChatSessionsService` consumers don't know about providers directly --- .../browser/chatSessions/chatSessions.contribution.ts | 8 ++++++-- .../workbench/contrib/chat/common/chatSessionsService.ts | 2 +- .../contrib/chat/test/common/mockChatSessionsService.ts | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts b/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts index 3bef1b718b9..826ab2dadfa 100644 --- a/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts +++ b/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts @@ -730,7 +730,11 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ return this._isContributionAvailable(contribution) ? contribution : undefined; } - async activateChatSessionItemProvider(chatViewType: string): Promise { + async activateChatSessionItemProvider(chatViewType: string): Promise { + await this.doActivateChatSessionItemProvider(chatViewType); + } + + private async doActivateChatSessionItemProvider(chatViewType: string): Promise { await this._extensionService.whenInstalledExtensionsRegistered(); const resolvedType = this._resolveToPrimaryType(chatViewType); if (resolvedType) { @@ -777,7 +781,7 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ continue; // skip: not considered for resolving } - const provider = await this.activateChatSessionItemProvider(contrib.type); + const provider = await this.doActivateChatSessionItemProvider(contrib.type); if (!provider) { // We requested this provider but it is not available if (providersToResolve?.includes(contrib.type)) { diff --git a/src/vs/workbench/contrib/chat/common/chatSessionsService.ts b/src/vs/workbench/contrib/chat/common/chatSessionsService.ts index 871c9e3ade0..8f03b310d03 100644 --- a/src/vs/workbench/contrib/chat/common/chatSessionsService.ts +++ b/src/vs/workbench/contrib/chat/common/chatSessionsService.ts @@ -215,7 +215,7 @@ export interface IChatSessionsService { getChatSessionContribution(chatSessionType: string): IChatSessionsExtensionPoint | undefined; registerChatSessionItemProvider(provider: IChatSessionItemProvider): IDisposable; - activateChatSessionItemProvider(chatSessionType: string): Promise; + activateChatSessionItemProvider(chatSessionType: string): Promise; getAllChatSessionContributions(): IChatSessionsExtensionPoint[]; getIconForSessionType(chatSessionType: string): ThemeIcon | URI | undefined; diff --git a/src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts b/src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts index 73d80c7f11b..20636d58572 100644 --- a/src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts +++ b/src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts @@ -86,8 +86,8 @@ export class MockChatSessionsService implements IChatSessionsService { this.contributions = contributions; } - async activateChatSessionItemProvider(chatSessionType: string): Promise { - return this.sessionItemProviders.get(chatSessionType); + async activateChatSessionItemProvider(chatSessionType: string): Promise { + // Noop, nothing to activate } getIconForSessionType(chatSessionType: string): ThemeIcon | URI | undefined {