Open new EditorTerminal on Reopen Editor command #282403
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
EditorTerminalfrom the history stack viaworkbench.action.reopenClosedEditoroften 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
editorIdof the last closed editor input. If the input matches the Terminal Editor ID ('terminalEditor'):editorService.openEditorcall (which caused the timeout) is skipped.workbench.action.terminal.createTerminalEditoris executed, reliably creating a brand new, functional terminal instance in the editor area.recentlyClosedEditorsstack 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:
.jsor.txtfile). We'll call this Editor A.View: Create New Terminal in Editor Area(workbench.action.terminal.createTerminalEditor). We'll call this Editor B (the Editor Terminal).File: Reopen Closed Editor(workbench.action.reopenClosedEditor).Expected Behavior (With this PR Applied):
Request {number} timed out (15000ms)error.File: Reopen Closed Editorshould now correctly reopen Editor A (the standard file editor), demonstrating that the history stack was correctly cleaned and is no longer corrupted.