Add setting to keep unavailable entries in recently opened list - #325342
Open
Victor Irzak (virzak) wants to merge 1 commit into
Open
Add setting to keep unavailable entries in recently opened list#325342Victor Irzak (virzak) wants to merge 1 commit into
Victor Irzak (virzak) wants to merge 1 commit into
Conversation
…#164491) Adds window.removeRecentEntriesWhenUnavailable (default true). When disabled, entries whose path is currently inaccessible (e.g. a subst or removable drive that is not mounted yet) are no longer pruned from the recently opened list at startup or when opening them fails. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MEcyivcz7hSfwq7H4DPkBz
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an application setting to preserve temporarily unavailable entries in the recently opened list while retaining existing behavior by default.
Changes:
- Registers
window.removeRecentEntriesWhenUnavailable. - Gates automatic removal during path resolution and recent-menu opening.
- Extends
IWindowSettingswith the new option.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/vs/workbench/electron-browser/desktop.contribution.ts |
Registers the setting. |
src/vs/platform/windows/electron-main/windowsMainService.ts |
Gates removal after path-resolution failures. |
src/vs/platform/window/common/window.ts |
Adds the setting type. |
src/vs/platform/menubar/electron-main/menubar.ts |
Gates removal after recent-menu failures. |
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 #164491
Problem
VS Code silently removes entries from the "Recently Opened" list whenever their path cannot be accessed. For users whose folders live on drives that are only temporarily unavailable (e.g.
subst-mapped drives that are not yet mapped at startup, removable media, network shares), this permanently loses history that would be perfectly valid a minute later.Change
Adds a new setting,
window.removeRecentEntriesWhenUnavailable(boolean, defaulttrue, application scope). The default preserves existing behavior; setting it tofalsekeeps unavailable entries in the list.Two removal sites are gated behind the setting:
WindowsMainService.doResolveFilePath: removed an entry wheneverfs.staton its path threw. This is the code path that fires at startup when restoring windows and when opening a recent entry, and it covers folders, workspace files, and files alike.Menubar.createOpenRecentMenuItem: removed an entry when opening it from File > Open Recent failed.Explicit user removals (the "Remove from Recently Opened" buttons) and removal on actual file-delete operations in
HistoryServiceare intentionally left untouched, since those are genuine deletions rather than temporary unavailability. The "Path does not exist" dialog still shows when opening an unavailable entry; the only change is that the entry survives to be opened later.Testing
tsc --noEmitonsrc/tsconfig.jsonpasses.substdrive (isolated--user-data-dir/--shared-data-dir, inspecting the persistedhistory.recentlyOpenedPathsListafter each run):false, drive unmapped, relaunch: entry kept, and the folder opens normally once the drive is mapped again🤖 Generated with Claude Code
https://claude.ai/code/session_01MEcyivcz7hSfwq7H4DPkBz