fix: resolve default view for markdown files on first startup#308739
Merged
mjbvz merged 1 commit intomicrosoft:mainfrom Apr 9, 2026
Merged
Conversation
…oft#244597) Check user-configured editor associations as a fallback when the editor resolver cache is empty, ensuring custom editors are available on first startup.
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @bpaseroMatched files:
|
alexdima
approved these changes
Apr 9, 2026
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 #244597
Summary
Bug: Default view for markdown files doesn't work on first startup -- the user-configured custom editor (e.g., markdown preview) is not used when opening
.mdfiles for the first time.Root Cause: The
EditorResolverServiceuses a cache of glob patterns (persisted viaStorageService) to decide whether to wait for extensions to register before resolving editors. On first startup, this cache is empty because it is only populated duringonWillSaveState, so the resolver skips waiting for extensions and falls back to the default text editor.Fix: Added a
resourceMatchesUserAssociation()method that checks if the resource matches any user-configurededitorAssociationspointing to a non-default editor. This is used as a fallback alongside the existing cache check, ensuring the resolver waits for extensions even on first startup when the cache is empty.Changes
src/vs/workbench/services/editor/browser/editorResolverService.ts: AddedresourceMatchesUserAssociation()method and updated the cache check condition to also consider user-configured editor associations as a fallback.src/vs/workbench/services/editor/test/browser/editorResolverService.test.ts: Added regression test that verifies user-configured editor associations resolve correctly even with an empty cache (simulating first startup).Test Plan
User-configured editor association resolves on first startup with empty cache #244597.mdfile uses the configured custom editor (e.g., markdown preview) on first startup