eclipse-theia/theia

Support first-class non-recursive file watching (à la VS Code)

Open

#17,700 opened on Jun 23, 2026

View on GitHub
 (0 comments) (0 reactions) (0 assignees)TypeScript (2,478 forks)batch import
enhancementfile-watchersfilesystemhelp wanted

Repository metrics

Stars
 (18,676 stars)
PR merge metrics
 (Avg merge 15d 4h) (75 merged PRs in 30d)

Description

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 recursive through filesystem-watcher-protocol WatchOptions and DiskFileSystemProvider.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.

Contributor guide