Skip to content

Commit 36e6e8e

Browse files
authored
Transfer editing session for Contributed Sessions when Chat editor is in side panel (#281388)
1 parent a8d6ec6 commit 36e6e8e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/vs/workbench/api/browser/mainThreadChatSessions.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,13 @@ export class MainThreadChatSessions extends Disposable implements MainThreadChat
440440

441441
const chatViewWidget = this._chatWidgetService.getWidgetBySessionResource(originalResource);
442442
if (chatViewWidget && isIChatViewViewContext(chatViewWidget.viewContext)) {
443-
await this._chatSessionsService.getOrCreateChatSession(modifiedResource, CancellationToken.None);
443+
const newSession = await this._chatSessionsService.getOrCreateChatSession(modifiedResource, CancellationToken.None);
444+
// If chat editor is in the side panel, then those are not listed as editors.
445+
// In that case we need to transfer editing session using the original model.
446+
const originalModel = this._chatService.getSession(originalResource);
447+
if (originalModel) {
448+
newSession.initialEditingSession = originalModel.editingSession;
449+
}
444450
await this._chatWidgetService.openSession(modifiedResource, ChatViewPaneTarget, { preserveFocus: true });
445451
}
446452
}

0 commit comments

Comments
 (0)