Fix preset watcher infinite reload loop via controller-level debouncing and stable watcher identity #4669
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.
This change addresses item #4668
This changes visible behavior
The following changes are proposed:
The purpose of this change
Preset watchers caused infinite reload loops due to:
reapplyPresets()calls from event handlers bypassed debouncingSolution: Three-layer fix
Controller-level debouncing:
Stable watcher identity:
Simplified FileWatcher:
awaitWriteFinish: { stabilityThreshold: 200, pollInterval: 100 }for file write stabilityOther Notes/Information
Pending request mechanism ensures no lost reapplies during concurrent operations:
Why 200ms debounce: Collapses rapid events (editor saves, batch ops) while maintaining responsive UX.
Why original paths in FileWatcher: Chokidar handles symlinks internally via
followSymlinksoption. Canonical paths only used for stable key generation.Original prompt
This section details on the original issue you should resolve
<issue_title>[Bug] Infinity presets reloading</issue_title>
<issue_description>### Brief Issue Summary
I use only
CMakeUserPresets.jsonwithoutCMakePresets.jsonand got looped presets reloading with Cmake Tools 1.22.26CMake Tools Diagnostics
{ "os": "linux", "vscodeVersion": "1.109.0-insider", "cmtVersion": "1.22.26", "configurations": [ { "folder": "/home/sr_team/Projects/Arizona/engine/dev", "cmakeVersion": "4.2.2", "configured": true, "generator": "Ninja", "usesPresets": true, "compilers": {} } ], "cpptoolsIntegration": { "isReady": false, "hasCodeModel": false, "activeBuildType": "", "buildTypesSeen": [], "requests": [], "responses": [], "partialMatches": [], "targetCount": 0, "executablesCount": 0, "librariesCount": 0, "targets": [] }, "settings": [ { "communicationMode": "automatic", "useCMakePresets": "auto", "configureOnOpen": false } ] }Debug Log