file watcher: avoid fs.watch
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
nodejs `fs.watch` is unreliable, see https://github.com/aws/aws-toolkit-vscode/pull/2381
- From https://github.com/paulmillr/chokidar#why :
> Node.js fs.watch ... Emits most changes as rename.
- os/platform-specific quirks
~~The reason we use fs.watch for cases like https://github.com/aws/aws-toolkit-vscode/pull/2381/files is because vscode's builtin watcher only works for files in a workspace folder. https://github.com/microsoft/vscode/issues/3025~~
- Update: vscode watcher now supports out-of-workspace paths. https://github.com/microsoft/vscode/issues/3025#issuecomment-1011815376
- Update (2023): vscode proposal for a new `createFileSystemWatcher` API https://github.com/microsoft/vscode/issues/169724
## Proposal
- ~~use https://github.com/paulmillr/chokidar or https://www.npmjs.com/package/fb-watchman instead of `fs.watch`~~
- Use vscode native support https://github.com/microsoft/vscode/issues/3025
- potential future advantage: this would presumably also work with the vscode virtual fs (VFS) layer #2205 #1823
Contributor guide
Research direction
Start by locating the current fs.watch call sites related to pull request #2381, then read the VS Code native watcher discussion in issue #3025 and the newer createFileSystemWatcher proposal. Done means replacing the unreliable watcher use with VS Code native support for the affected out-of-workspace paths and verifying the relevant file-change behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript, vscode
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100