Repository navigation
Reopen Closed Editor only reopens editors closed at the current folder location - #350575
Merged
Sandeep Somavarapu (sandy081) merged 5 commits intoNov 26, 2026
Merged
Sandeep Somavarapu (sandy081) merged 5 commits into
Sandeep Somavarapu (sandy081) merged 5 commits into
Conversation
…ent folder location (#350325) A folder location switch puts away the recently closed editors of the folder it leaves, in memory only, and restores the ones put away for the folder it enters. Editors that the switch closes are not recorded as recently closed. Deleting a file also removes it from the put away lists. Co-authored-by: Copilot <[email protected]>
…witch closes explicitly and follow moves (#350325) - The folder location owner applies its working sets with the new switchesEditors option; editor parts report isSwitchingEditors while such an apply runs, including its fallback. History no longer infers switch closes from a workspace event followed by the next working-set apply. - Each recently closed editor records the location where it was closed; a switch puts away and restores a location's list as a unit, and closing an editor only replaces its entry in the current location's list. - Moves rewrite plain resource editors in the put away lists, drop the ones that cannot be rewritten, and move the list of a moved location. Co-authored-by: Copilot <[email protected]>
…closes at any location, and key locations without trailing separators (#350325) - New EditorCloseContext.SWITCH: applying a working set with switchesEditors closes its editors with that context (ICloseAllEditorsOptions.context), replacing the window-wide isSwitchingEditors state. History skips exactly those closes, so a user or other close while a switch apply is pending is still recorded. - Reopen history no longer drops a user close because the editor's resource is in a folder that a switch left: it is recorded at the current location. - Location keys drop trailing separators (root-aware), so a moved location root re-keys its put away list when the source or target has one. Co-authored-by: Copilot <[email protected]>
… UNC share roots in location keys (#350325) - IAuxiliaryEditorPart.close takes the close context: applying a working set that switches the editors passes SWITCH to the part's own close pass too, so an editor that the first pass skipped and that the part then closes is not recorded as recently closed. - Location keys use the Folder Locations identity rule (now shared from platform/workspace/common/folderLocations.ts as withoutTrailingSeparator), which also folds the trailing separator of a UNC share root. Co-authored-by: Copilot <[email protected]>
…on whose list is active (#350325) The workspace folder changes before its change is published. Closes in between were deduplicated against the active list of the location being left but tagged with the new folder. History now tracks the location of its recently closed editors and only changes it when the change of the workspace folders is published, together with the lists. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A Folder Location switch during a pending reopen batch can open remaining editors in the wrong location and lose their history entries, requiring cancellation, restoration, and regression coverage.
1 open issue
What changed in this PR
Makes Reopen Closed Editor specific to the current Folder Location, complementing the existing per-location open-editor and recently opened history.
Changes:
- Saves and restores recently closed editors per location in memory, updating saved entries after moves and deletes.
- Adds a
SWITCHclose context so working-set transitions do not count as user closes. - Adds tests for location isolation, path normalization, and close-context propagation.
| File | Description |
|---|---|
| src/vs/workbench/services/workspaces/common/workspaceFolderLocationService.ts | Reuses the shared folder-path normalization helper. |
| src/vs/workbench/services/history/test/browser/historyService.test.ts | Tests per-location closed-editor history and file operations. |
| src/vs/workbench/services/history/browser/historyService.ts | Stores and restores closed-editor history by location. |
| src/vs/workbench/services/editor/test/browser/editorParts.test.ts | Tests switch close contexts in main and auxiliary parts. |
| src/vs/workbench/services/editor/common/editorGroupsService.ts | Adds switch and close-context options to editor contracts. |
| src/vs/workbench/contrib/workspaces/browser/folderLocationWorkingSets.ts | Marks location working-set applications as editor switches. |
| src/vs/workbench/common/editor.ts | Defines the SWITCH close context. |
| src/vs/workbench/browser/parts/editor/editorParts.ts | Propagates switch context during working-set application. |
| src/vs/workbench/browser/parts/editor/editorPart.ts | Passes close context through state restoration. |
| src/vs/workbench/browser/parts/editor/editorGroupView.ts | Preserves close context when closing all editors. |
| src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.ts | Forwards close context when closing auxiliary parts. |
| src/vs/platform/workspace/common/folderLocations.ts | Exports shared trailing-separator normalization. |
Review effort: Balanced
Sandeep Somavarapu (sandy081)
marked this pull request as ready for review
November 26, 2026 17:18
Ladislau Szomoru (lszomoru)
approved these changes
Nov 26, 2026
Alexandru Dima (alexdima)
approved these changes
Nov 26, 2026
Sandeep Somavarapu (sandy081)
deleted the
agents/reopen-closed-editor-per-location
branch
November 26, 2026 21:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Fixes #350325
After a Folder Location switch, Reopen Closed Editor only reopens editors closed at the current location. Each location keeps its closed editors in memory for the window; switching back restores them. Editors the switch itself closes aren't recorded (new close context SWITCH). Deletes and moves keep the lists current.
Test: switch between a folder and its worktree, close editors at each, press Cmd+Shift+T.
Written by GitHub Copilot on behalf of Sandeep Somavarapu (@sandy081)