Support first-class non-recursive file watching (à la VS Code)
#17,700 创建于 2026年6月23日
仓库指标
- 星标
- (18,676 个星标)
- PR 合并指标
- (平均合并 15天 4小时) (30 天内合并 75 个 PR)
描述
Feature Description:
Follow-up to the review discussion in #17633 and the "root cause" option in #17632.
Theia's backend always watches recursively: DiskFileSystemProvider.watch forwards only { ignored } to the watcher server, and @parcel/watcher's subscribe() has no non-recursive mode. The recursive flag is carried from the frontend through RPC but dropped at the provider, so a non-recursive watch is silently turned into a full recursive crawl.
#17633 mitigates this by skipping non-recursive watches rooted at a strict ancestor of a workspace root, at the cost of losing workspace-folder-self-deletion detection for those watchers.
Proposal: honor recursive end-to-end by adding a dedicated non-recursive watcher (e.g. Node fs.watch(dir, { recursive: false })), mirroring VS Code, which routes non-recursive requests to its own NodeJSWatcher distinct from the recursive (parcel) one. This entails:
- threading
recursivethroughfilesystem-watcher-protocolWatchOptionsandDiskFileSystemProvider.watch; - a new backend non-recursive watcher with its own event mapping and cross-platform handling;
- routing non-recursive requests to it instead of parcel.
This would remove the need to drop ancestor watches and restore workspace-folder-self-deletion detection.