Skip to content

Commit f74d10d

Browse files
committed
Address review comments
1 parent 6c81721 commit f74d10d

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

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

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,13 @@ export class MainThreadChatSessions extends Disposable implements MainThreadChat
419419
}
420420
};
421421

422-
if (originalEditor) {
423-
// Prefetch the chat session content to make the subsequent editor swap quick
424-
const newSession = await this._chatSessionsService.getOrCreateChatSession(
425-
URI.revive(modifiedResource),
426-
CancellationToken.None,
427-
);
422+
// Prefetch the chat session content to make the subsequent editor swap quick
423+
const newSession = await this._chatSessionsService.getOrCreateChatSession(
424+
URI.revive(modifiedResource),
425+
CancellationToken.None,
426+
);
428427

428+
if (originalEditor) {
429429
newSession.transferredState = originalEditor instanceof ChatEditorInput
430430
? { editingSession: originalEditor.transferOutEditingSession(), inputState: originalModel?.inputModel.toJSON() }
431431
: undefined;
@@ -440,17 +440,13 @@ export class MainThreadChatSessions extends Disposable implements MainThreadChat
440440
return;
441441
}
442442

443-
{
444-
const newSession = await this._chatSessionsService.getOrCreateChatSession(modifiedResource, CancellationToken.None);
445-
// If chat editor is in the side panel, then those are not listed as editors.
446-
// In that case we need to transfer editing session using the original model.
447-
const originalModel = this._chatService.getSession(originalResource);
448-
if (originalModel) {
449-
newSession.transferredState = {
450-
editingSession: originalModel.editingSession,
451-
inputState: originalModel.inputModel.toJSON()
452-
};
453-
}
443+
// If chat editor is in the side panel, then those are not listed as editors.
444+
// In that case we need to transfer editing session using the original model.
445+
if (originalModel) {
446+
newSession.transferredState = {
447+
editingSession: originalModel.editingSession,
448+
inputState: originalModel.inputModel.toJSON()
449+
};
454450
}
455451

456452
const chatViewWidget = this._chatWidgetService.getWidgetBySessionResource(originalResource);

0 commit comments

Comments
 (0)