Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix file system watcher not detecting config changes on Windows#3938

Merged
ntotten merged 3 commits intomainfrom
fs_watcher_fix
Jan 21, 2026
Merged

Fix file system watcher not detecting config changes on Windows#3938
ntotten merged 3 commits intomainfrom
fs_watcher_fix

Conversation

@ntotten
Copy link
Member

@ntotten ntotten commented Jan 21, 2026

Summary

  • Replace the single file system watcher using brace expansion pattern (**/{.prettierrc,.prettierrc.json,...}) 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

Fixes: #3926

Test plan

  • Verify config file changes are detected on Windows
  • Verify config file changes are detected on macOS/Linux
  • Test that modifying .prettierrc, .prettierrc.json, prettier.config.js, and .editorconfig triggers formatter reset

See: microsoft/vscode#177617

🤖 Generated with Claude Code

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]>
Copilot AI review requested due to automatic review settings January 21, 2026 22:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_FILES constant array

Verifies that modifying .prettierrc triggers the file watcher
and applies the new formatting configuration.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@@ -0,0 +1,3 @@
function foo() {
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]>
@ntotten ntotten merged commit 61b4780 into main Jan 21, 2026
13 checks passed
@ntotten ntotten deleted the fs_watcher_fix branch January 21, 2026 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Poor caching of config files

2 participants