Skip to content

Commit

Permalink
Add an optional submitType arg to submitChat() in ChatsController
Browse files Browse the repository at this point in the history
  • Loading branch information
ykdojo committed Oct 24, 2024
1 parent e4825cb commit aad9b24
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion vscode/src/chat/chat-view/ChatsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,19 @@ export class ChatsController implements vscode.Disposable {
contextItems,
source = DEFAULT_EVENT_SOURCE,
command,
submitType = 'new-chat',
}: ExecuteChatArguments): Promise<ChatSession | undefined> {
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()
}
Expand Down
1 change: 1 addition & 0 deletions vscode/src/commands/execute/ask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface ExecuteChatArguments extends Omit<WebviewSubmitMessage, 'text'
source?: EventSource
command?: DefaultChatCommands
text: PromptString
submitType?: 'new-chat' | 'continue-chat'
}

/**
Expand Down

0 comments on commit aad9b24

Please sign in to comment.