[vscode-graphql] Server crashes when handling watcher notifications for files that are quickly deleted
- Dominant language
- TypeScript
- Stars
- 16.9k
- Forks
- 1.9k
- Avg merge
- 22h 45m
- Merged PRs (30d)
- 70
Description
## Problem
I'm using Sapling SCM instead of Git, and it has a `.sl/` folder which can often contain files that have a very short lifespan.
My extension crashes quickly because the watcher is looking at this directory, since it's not ignored by default like `.git` is, and it often comes across this error:
```
Error: ENOENT: no such file or directory, open '/home/murt/my_code/.sl/runlog/abc.json'
at Object.openSync (node:fs:603:3)
at Object.func [as openSync] (node:electron/js2c/asar_bundle:2:1869)
at readFileSync (node:fs:471:35)
at t.readFileSync (node:electron/js2c/asar_bundle:2:9212)
at /home/murt/.vscode/extensions/graphql.vscode-graphql-0.8.19/out/server/index.js:4635:5136
at Array.map ()
at QGe.handleWatchedFilesChangedNotification (/home/murt/.vscode/extensions/graphql.vscode-graphql-0.8.19/out/server/index.js:4635:4844)
at /home/murt/.vscode/extensions/graphql.vscode-graphql-0.8.19/out/server/index.js:4669:103056
at Z (/home/murt/.vscode/extensions/graphql.vscode-graphql-0.8.19/out/server/index.js:4644:1611)
at G (/home/murt/.vscode/extensions/graphql.vscode-graphql-0.8.19/out/server/index.js:4643:6757) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/home/murt/my_code/.sl/runlog/abc.json'
}
Node.js v18.15.0
[Error - 12:29:30 PM] The vscode-graphql server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Info - 12:29:30 PM] The graphql server has stopped running
```
I'm currently using the latest versions of the extensions:
- GraphQL: Language Feature Support `v0.8.19`
- GraphQL: Syntax Highlighting: `v1.2.2`
## Potential Solution
I locally built the extension by modifying the `workspace.createFileSystemWatcher` to take in my hardcoded workspace path excluding the `.sl` folder, but this is obviously not the correct long term solution since I would need to redo this each time there's an update if I want to keep the latest version.
I think we could add a VSCode setting to exclude specific file paths from the watcher, or alternatively specify the base path to watch from.
I unfortunately don't have too much time to create a PR for a proper solution but I think it's at least worth noting the issue here.
Contributor guide
Assessment
This issue has not been assessed yet.