@@ -87,6 +87,9 @@ class LocalTerminalBackend extends BaseTerminalBackend implements ITerminalBacke
8787 this . _proxy = ProxyChannel . toService < IPtyService > ( getDelayedChannel ( clientEventually . p . then ( client => client . getChannel ( TerminalIpcChannels . PtyHostWindow ) ) ) ) ;
8888 this . _connectToDirectProxy ( clientEventually ) ;
8989 } ) ) ;
90+
91+ // Eagerly fetch the backend's environment for memoization
92+ this . getEnvironment ( ) ;
9093 }
9194
9295 private async _connectToDirectProxy ( clientEventually : DeferredPromise < MessagePortClient > ) : Promise < void > {
@@ -242,6 +245,7 @@ class LocalTerminalBackend extends BaseTerminalBackend implements ITerminalBacke
242245 return this . _proxy . getEnvironment ( ) ;
243246 }
244247
248+ @memoize
245249 async getShellEnvironment ( ) : Promise < IProcessEnvironment > {
246250 return this . _shellEnvironmentService . getShellEnv ( ) ;
247251 }
@@ -288,15 +292,15 @@ class LocalTerminalBackend extends BaseTerminalBackend implements ITerminalBacke
288292 mark ( 'code/terminal/didGetReviveEnvironments' ) ;
289293
290294 mark ( 'code/terminal/willReviveTerminalProcesses' ) ;
291- await this . _localPtyService . reviveTerminalProcesses ( parsed , Intl . DateTimeFormat ( ) . resolvedOptions ( ) . locale ) ;
295+ await this . _proxy . reviveTerminalProcesses ( parsed , Intl . DateTimeFormat ( ) . resolvedOptions ( ) . locale ) ;
292296 mark ( 'code/terminal/didReviveTerminalProcesses' ) ;
293297 this . _storageService . remove ( TerminalStorageKeys . TerminalBufferState , StorageScope . WORKSPACE ) ;
294298 // If reviving processes, send the terminal layout info back to the pty host as it
295299 // will not have been persisted on application exit
296300 const layoutInfo = this . _storageService . get ( TerminalStorageKeys . TerminalLayoutInfo , StorageScope . WORKSPACE ) ;
297301 if ( layoutInfo ) {
298302 mark ( 'code/terminal/willSetTerminalLayoutInfo' ) ;
299- await this . _localPtyService . setTerminalLayoutInfo ( JSON . parse ( layoutInfo ) ) ;
303+ await this . _proxy . setTerminalLayoutInfo ( JSON . parse ( layoutInfo ) ) ;
300304 mark ( 'code/terminal/didSetTerminalLayoutInfo' ) ;
301305 this . _storageService . remove ( TerminalStorageKeys . TerminalLayoutInfo , StorageScope . WORKSPACE ) ;
302306 }
@@ -305,7 +309,7 @@ class LocalTerminalBackend extends BaseTerminalBackend implements ITerminalBacke
305309 }
306310 }
307311
308- return this . _localPtyService . getTerminalLayoutInfo ( layoutArgs ) ;
312+ return this . _proxy . getTerminalLayoutInfo ( layoutArgs ) ;
309313 }
310314
311315 private async _resolveEnvironmentForRevive ( variableResolver : terminalEnvironment . VariableResolver | undefined , shellLaunchConfig : IShellLaunchConfig ) : Promise < IProcessEnvironment > {
0 commit comments