From d5f6bc6a839dfd39a5b2d87b993cd42acdf97cf4 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 23 Jun 2023 15:35:37 -0700 Subject: [PATCH] Improve pty host startup marks/logging Part of #185393 --- src/vs/platform/terminal/node/ptyService.ts | 1 - .../terminal/electron-sandbox/localTerminalBackend.ts | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/vs/platform/terminal/node/ptyService.ts b/src/vs/platform/terminal/node/ptyService.ts index 74febb4b18a..d976de219a3 100644 --- a/src/vs/platform/terminal/node/ptyService.ts +++ b/src/vs/platform/terminal/node/ptyService.ts @@ -506,7 +506,6 @@ export class PtyService extends Disposable implements IPtyService { if (layout) { const expandedTabs = await Promise.all(layout.tabs.map(async tab => this._expandTerminalTab(tab))); const tabs = expandedTabs.filter(t => t.terminals.length > 0); - this._logService.trace('PtyService.getTerminalLayoutInfo result', tabs); performance.mark('code/didGetTerminalLayoutInfo'); return { tabs }; } diff --git a/src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalBackend.ts b/src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalBackend.ts index b90665b55e5..0a07fa58338 100644 --- a/src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalBackend.ts +++ b/src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalBackend.ts @@ -94,10 +94,10 @@ class LocalTerminalBackend extends BaseTerminalBackend implements ITerminalBacke // The pty host should not get launched until the first window restored phase await this._lifecycleService.when(LifecyclePhase.Restored); - mark('code/willConnectPtyHost'); + mark('code/terminal/willConnectPtyHost'); this._logService.trace('Renderer->PtyHost#connect: before acquirePort'); acquirePort('vscode:createPtyHostMessageChannel', 'vscode:createPtyHostMessageChannelResult').then(port => { - mark('code/didConnectPtyHost'); + mark('code/terminal/didConnectPtyHost'); this._logService.trace('Renderer->PtyHost#connect: connection established'); // There are two connections to the pty host; one to the regular shared process // _localPtyService, and one directly via message port _ptyHostDirectProxy. The former is @@ -279,18 +279,24 @@ class LocalTerminalBackend extends BaseTerminalBackend implements ITerminalBacke // Re-resolve the environments and replace it on the state so local terminals use a fresh // environment + mark('code/terminal/willGetReviveEnvironments'); for (const state of parsed) { const freshEnv = await this._resolveEnvironmentForRevive(variableResolver, state.shellLaunchConfig); state.processLaunchConfig.env = freshEnv; } + mark('code/terminal/didGetReviveEnvironments'); + mark('code/terminal/willReviveTerminalProcesses'); await this._localPtyService.reviveTerminalProcesses(parsed, Intl.DateTimeFormat().resolvedOptions().locale); + mark('code/terminal/didReviveTerminalProcesses'); this._storageService.remove(TerminalStorageKeys.TerminalBufferState, StorageScope.WORKSPACE); // If reviving processes, send the terminal layout info back to the pty host as it // will not have been persisted on application exit const layoutInfo = this._storageService.get(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE); if (layoutInfo) { + mark('code/terminal/willSetTerminalLayoutInfo'); await this._localPtyService.setTerminalLayoutInfo(JSON.parse(layoutInfo)); + mark('code/terminal/didSetTerminalLayoutInfo'); this._storageService.remove(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE); } } catch {