Transfer editing session for Contributed Sessions when Chat editor is in side panel (#281388)

This commit is contained in:
Don Jayamanne
2025-12-05 10:49:05 +11:00
committed by GitHub
parent a8d6ec67f6
commit 36e6e8ecea
@@ -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 });
}
}