From 36e6e8eceae2faf08058351c6eeef44a58a8e0b0 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Fri, 5 Dec 2025 10:49:05 +1100 Subject: [PATCH] Transfer editing session for Contributed Sessions when Chat editor is in side panel (#281388) --- src/vs/workbench/api/browser/mainThreadChatSessions.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/api/browser/mainThreadChatSessions.ts b/src/vs/workbench/api/browser/mainThreadChatSessions.ts index f4903e774e4..502294b7652 100644 --- a/src/vs/workbench/api/browser/mainThreadChatSessions.ts +++ b/src/vs/workbench/api/browser/mainThreadChatSessions.ts @@ -440,7 +440,13 @@ export class MainThreadChatSessions extends Disposable implements MainThreadChat const chatViewWidget = this._chatWidgetService.getWidgetBySessionResource(originalResource); if (chatViewWidget && isIChatViewViewContext(chatViewWidget.viewContext)) { - await this._chatSessionsService.getOrCreateChatSession(modifiedResource, CancellationToken.None); + const newSession = await this._chatSessionsService.getOrCreateChatSession(modifiedResource, CancellationToken.None); + // If chat editor is in the side panel, then those are not listed as editors. + // In that case we need to transfer editing session using the original model. + const originalModel = this._chatService.getSession(originalResource); + if (originalModel) { + newSession.initialEditingSession = originalModel.editingSession; + } await this._chatWidgetService.openSession(modifiedResource, ChatViewPaneTarget, { preserveFocus: true }); } }