Fix file system watcher not detecting config changes on Windows#3938
Merged
Fix file system watcher not detecting config changes on Windows#3938
Conversation
Replace the single file system watcher using brace expansion pattern
with multiple watchers using simpler glob patterns. VS Code's
createFileSystemWatcher doesn't reliably support complex {a,b,c}
patterns across all platforms, particularly on Windows.
Fixes config file change detection for .prettierrc, .prettierrc.*,
prettier.config.*, and .editorconfig files.
See: microsoft/vscode#177617
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a Windows-specific bug where Prettier config file changes weren't being detected due to VS Code's file system watcher not reliably supporting complex brace expansion patterns ({a,b,c}) on all platforms.
Changes:
- Replaced single file system watcher using brace expansion with multiple individual watchers
- Added explanatory comment linking to the upstream VS Code issue
- Removed the now-unused
PRETTIER_CONFIG_FILESconstant array
Verifies that modifying .prettierrc triggers the file watcher and applies the new formatting configuration. Co-Authored-By: Claude Opus 4.5 <[email protected]>
When a Prettier config file is modified, the file watcher now calls clearModuleCache to clear Prettier's internal config cache. This ensures the updated configuration is applied on the next format. Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.
Summary
**/{.prettierrc,.prettierrc.json,...}) with multiple watchers using simpler glob patternscreateFileSystemWatcherdoesn't reliably support complex{a,b,c}patterns across all platforms, particularly on Windows.prettierrc,.prettierrc.*,prettier.config.*, and.editorconfigfilesFixes: #3926
Test plan
.prettierrc,.prettierrc.json,prettier.config.js, and.editorconfigtriggers formatter resetSee: microsoft/vscode#177617
🤖 Generated with Claude Code