From 6be9a301e86fd78ffbc2ba3a59dd12612c163a08 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Fri, 27 Sep 2024 17:19:10 +0200 Subject: [PATCH] edit chat view: start editing session when created (#229975) --- src/vs/workbench/contrib/chat/browser/chatInputPart.ts | 2 +- src/vs/workbench/contrib/chat/browser/chatWidget.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/chat/browser/chatInputPart.ts b/src/vs/workbench/contrib/chat/browser/chatInputPart.ts index c72164bb1aabd..fd2a0aeabb2ba 100644 --- a/src/vs/workbench/contrib/chat/browser/chatInputPart.ts +++ b/src/vs/workbench/contrib/chat/browser/chatInputPart.ts @@ -539,7 +539,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge const toolbarsContainer = elements.inputToolbars; this.chatEditingSessionWidgetContainer = elements.chatEditingSessionWidgetContainer; this.initAttachedContext(this.attachedContextContainer); - this.renderChatEditingSessionState(null, this.location === ChatAgentLocation.EditingSession); + this.renderChatEditingSessionState(null); const inputScopedContextKeyService = this._register(this.contextKeyService.createScoped(inputContainer)); CONTEXT_IN_CHAT_INPUT.bindTo(inputScopedContextKeyService).set(true); diff --git a/src/vs/workbench/contrib/chat/browser/chatWidget.ts b/src/vs/workbench/contrib/chat/browser/chatWidget.ts index d319428ee6446..2d211eb939a0a 100644 --- a/src/vs/workbench/contrib/chat/browser/chatWidget.ts +++ b/src/vs/workbench/contrib/chat/browser/chatWidget.ts @@ -808,6 +808,14 @@ export class ChatWidget extends Disposable implements IChatWidget { } })); + if (this._location.location === ChatAgentLocation.EditingSession) { + const currentSession = this.chatEditingService.currentEditingSession; + if (currentSession && (currentSession.chatSessionId !== model.sessionId)) { + currentSession?.stop(); + } + this.chatEditingService.startOrContinueEditingSession(model.sessionId); + } + if (this.tree) { this.onDidChangeItems(); revealLastElement(this.tree);