From aad9b24e5ad115203fc48f4f0e86fa4b3c40edf2 Mon Sep 17 00:00:00 2001 From: YK <1811651+ykdojo@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:10:06 -0700 Subject: [PATCH] Add an optional submitType arg to submitChat() in ChatsController --- vscode/src/chat/chat-view/ChatsController.ts | 10 +++++++++- vscode/src/commands/execute/ask.ts | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/vscode/src/chat/chat-view/ChatsController.ts b/vscode/src/chat/chat-view/ChatsController.ts index 1f3cc4c2b68e..853a2e6d7797 100644 --- a/vscode/src/chat/chat-view/ChatsController.ts +++ b/vscode/src/chat/chat-view/ChatsController.ts @@ -322,11 +322,19 @@ export class ChatsController implements vscode.Disposable { contextItems, source = DEFAULT_EVENT_SOURCE, command, + submitType = 'new-chat', }: ExecuteChatArguments): Promise { let provider: ChatController // If the sidebar panel is visible and empty, use it instead of creating a new panel - if (this.panel.isVisible() && this.panel.isEmpty()) { + if (submitType === 'new-chat' && this.panel.isVisible() && this.panel.isEmpty()) { provider = this.panel + // For now, always use the side panel if it's visible. + // TODO: Let activeEditor be able to become this.panel, + // thus handling them both the side panel and a webview panel the same way. + } else if (submitType === 'continue-chat' && this.panel.isVisible()) { + provider = this.panel + } else if (submitType === 'continue-chat' && this.activeEditor?.webviewPanelOrView?.visible) { + provider = this.activeEditor } else { provider = await this.getOrCreateEditorChatController() } diff --git a/vscode/src/commands/execute/ask.ts b/vscode/src/commands/execute/ask.ts index df00c50d7adb..76b375ee443f 100644 --- a/vscode/src/commands/execute/ask.ts +++ b/vscode/src/commands/execute/ask.ts @@ -14,6 +14,7 @@ export interface ExecuteChatArguments extends Omit