|
6 | 6 | import { DeferredPromise } from 'vs/base/common/async'; |
7 | 7 | import { Emitter } from 'vs/base/common/event'; |
8 | 8 | import { revive } from 'vs/base/common/marshalling'; |
9 | | -import { PerformanceMark } from 'vs/base/common/performance'; |
| 9 | +import { PerformanceMark, mark } from 'vs/base/common/performance'; |
10 | 10 | import { IProcessEnvironment, OperatingSystem } from 'vs/base/common/platform'; |
11 | 11 | import { ICommandService } from 'vs/platform/commands/common/commands'; |
12 | 12 | import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; |
@@ -324,22 +324,28 @@ class RemoteTerminalBackend extends BaseTerminalBackend implements ITerminalBack |
324 | 324 | // Revive processes if needed |
325 | 325 | const serializedState = this._storageService.get(TerminalStorageKeys.TerminalBufferState, StorageScope.WORKSPACE); |
326 | 326 | const parsed = this._deserializeTerminalState(serializedState); |
327 | | - if (parsed) { |
328 | | - try { |
329 | | - // Note that remote terminals do not get their environment re-resolved unlike in local terminals |
330 | | - |
331 | | - await this._remoteTerminalChannel.reviveTerminalProcesses(parsed, Intl.DateTimeFormat().resolvedOptions().locale); |
332 | | - this._storageService.remove(TerminalStorageKeys.TerminalBufferState, StorageScope.WORKSPACE); |
333 | | - // If reviving processes, send the terminal layout info back to the pty host as it |
334 | | - // will not have been persisted on application exit |
335 | | - const layoutInfo = this._storageService.get(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE); |
336 | | - if (layoutInfo) { |
337 | | - await this._remoteTerminalChannel.setTerminalLayoutInfo(JSON.parse(layoutInfo)); |
338 | | - this._storageService.remove(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE); |
339 | | - } |
340 | | - } catch { |
341 | | - // no-op |
| 327 | + if (!parsed) { |
| 328 | + return undefined; |
| 329 | + } |
| 330 | + |
| 331 | + try { |
| 332 | + // Note that remote terminals do not get their environment re-resolved unlike in local terminals |
| 333 | + |
| 334 | + mark('code/terminal/willReviveTerminalProcessesRemote'); |
| 335 | + await this._remoteTerminalChannel.reviveTerminalProcesses(parsed, Intl.DateTimeFormat().resolvedOptions().locale); |
| 336 | + mark('code/terminal/didReviveTerminalProcessesRemote'); |
| 337 | + this._storageService.remove(TerminalStorageKeys.TerminalBufferState, StorageScope.WORKSPACE); |
| 338 | + // If reviving processes, send the terminal layout info back to the pty host as it |
| 339 | + // will not have been persisted on application exit |
| 340 | + const layoutInfo = this._storageService.get(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE); |
| 341 | + if (layoutInfo) { |
| 342 | + mark('code/terminal/willSetTerminalLayoutInfoRemote'); |
| 343 | + await this._remoteTerminalChannel.setTerminalLayoutInfo(JSON.parse(layoutInfo)); |
| 344 | + mark('code/terminal/didSetTerminalLayoutInfoRemote'); |
| 345 | + this._storageService.remove(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE); |
342 | 346 | } |
| 347 | + } catch (e: unknown) { |
| 348 | + this._logService.warn('RemoteTerminalBackend#getTerminalLayoutInfo Error', e && typeof e === 'object' && 'message' in e ? e.message : e); |
343 | 349 | } |
344 | 350 |
|
345 | 351 | return this._remoteTerminalChannel.getTerminalLayoutInfo(); |
|
0 commit comments