Skip to content

Commit 0760da1

Browse files
committed
add ChatSessionService.hasAnySessionOptions()
1 parent 95d5cfb commit 0760da1

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

src/vs/workbench/contrib/chat/browser/chatInputPart.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,10 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
11691169
return hideAll();
11701170
}
11711171

1172+
if (!this.chatSessionsService.hasAnySessionOptions(ctx.chatSessionResource)) {
1173+
return hideAll();
1174+
}
1175+
11721176
this.chatSessionHasOptions.set(true);
11731177

11741178
const currentWidgetGroupIds = new Set(this.chatSessionPickerWidgets.keys());

src/vs/workbench/contrib/chat/browser/chatSessions.contribution.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,11 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ
796796
this._sessions.delete(sessionResource);
797797
}
798798

799+
public hasAnySessionOptions(resource: URI): boolean {
800+
const session = this._sessions.get(resource);
801+
return !!session && !!session.options && Object.keys(session.options).length > 0;
802+
}
803+
799804
public getSessionOption(chatSessionType: string, resource: URI, optionId: string): string | undefined {
800805
const session = this._sessions.get(resource);
801806
return session?.getOption(optionId);

src/vs/workbench/contrib/chat/common/chatSessionsService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ export interface IChatSessionsService {
189189
canResolveChatSession(chatSessionResource: URI): Promise<boolean>;
190190
provideChatSessionContent(sessionResource: URI, token: CancellationToken): Promise<ChatSession>;
191191

192+
hasAnySessionOptions(resource: URI): boolean;
192193
getSessionOption(chatSessionType: string, sessionResource: URI, optionId: string): string | undefined;
193194
setSessionOption(chatSessionType: string, sessionResource: URI, optionId: string, value: string): boolean;
194195

src/vs/workbench/contrib/chat/test/common/mockChatSessionsService.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ export class MockChatSessionsService implements IChatSessionsService {
209209
return true;
210210
}
211211

212+
hasAnySessionOptions(resource: URI): boolean {
213+
return this.sessionOptions.has(resource) && this.sessionOptions.get(resource)!.size > 0;
214+
}
215+
212216
getCapabilitiesForSessionType(chatSessionType: string): IChatAgentAttachmentCapabilities | undefined {
213217
return this.contributions.find(c => c.type === chatSessionType)?.capabilities;
214218
}

0 commit comments

Comments
 (0)