@@ -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