Skip to content

Conversation

@Joemarcos99
Copy link

@Joemarcos99 Joemarcos99 commented Dec 10, 2025

Associated Issue: #280043

Description of Proposed Changes

This Pull Request addresses the terminal history timeout issue identified in #280043 by implementing a targeted workaround within the closed editor history restoration logic.

The core problem is that attempting to restore a closed EditorTerminal from the history stack via workbench.action.reopenClosedEditor often leads to a 15,000ms timeout error because terminal process restoration is complex, slow, and frequently fails.

Implementation Details (Workaround - Solution 2)

Instead of attempting the slow and unreliable history restoration, this fix checks the editorId of the last closed editor input. If the input matches the Terminal Editor ID ('terminalEditor'):

  1. Bypass Restoration: The standard editorService.openEditor call (which caused the timeout) is skipped.
  2. Execute Command: The command workbench.action.terminal.createTerminalEditor is executed, reliably creating a brand new, functional terminal instance in the editor area.
  3. Clean History: The problematic closed terminal entry is immediately removed from the recentlyClosedEditors stack to prevent history corruption.

This approach ensures the "Reopen Closed Editor" action never times out when the last closed item was a terminal, while still delivering a new, functional terminal editor to the user, satisfying the intent of the reopen command.

How to Test

To test that this change correctly handles the closed Terminal Editor history, please follow these steps:

  1. Preparation: Ensure you have the 'Editor Terminal' feature enabled/visible.
  2. Open an Editor: Open any standard file (e.g., a .js or .txt file). We'll call this Editor A.
  3. Open Editor Terminal: Execute the command View: Create New Terminal in Editor Area (workbench.action.terminal.createTerminalEditor). We'll call this Editor B (the Editor Terminal).
  4. Close Editor A: Close the standard file editor.
  5. Close Editor B: Close the Editor Terminal. All editors should now be closed.
  6. Attempt to Reopen: Execute the command File: Reopen Closed Editor (workbench.action.reopenClosedEditor).

Expected Behavior (With this PR Applied):

  1. There should be NO pop-up alert with the Request {number} timed out (15000ms) error.
  2. A NEW Terminal Editor should immediately open in the editor area, fulfilling the reopen request.
  3. Repeating the command File: Reopen Closed Editor should now correctly reopen Editor A (the standard file editor), demonstrating that the history stack was correctly cleaned and is no longer corrupted.

@vs-code-engineering
Copy link

vs-code-engineering bot commented Dec 10, 2025

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/workbench/services/history/browser/historyService.ts

@bpasero bpasero self-assigned this Dec 10, 2025
@Joemarcos99 Joemarcos99 changed the title Stop recording EditorTerminals in closed editor histories Open new EditorTerminal on Reopen Editor command Dec 10, 2025
@Joemarcos99
Copy link
Author

@microsoft-github-policy-service agree

@bpasero
Copy link
Member

bpasero commented Dec 10, 2025

This is a workaround I am not accepting due to layer issues.

@bpasero bpasero closed this Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants