Intended outcome:
--watch is able to track added, deleted and renamed files.
Actual outcome:
Currently only changes in preexisting files trigger watch.
How to reproduce the issue:
Try to create a query file matching includes pattern.
Further info:
There are two parts to this problem:
-
Watching logic is insufficient (no deletion and rename handling at least):
|
watcher.on("all", (event, file) => { |
-
Even after quick fix I made locally to handle specific cases:
...
watcher.on("changed", (file) => {
console.log('Watch event: changed', file);
this.project.fileDidChange(vscode_uri_1.default.file(file).toString());
});
watcher.on("deleted", (file) => {
console.log('Watch event: deleted', file);
this.project.fileWasDeleted(vscode_uri_1.default.file(file).toString());
});
watcher.on("added", (file) => {
console.log('Watch event: added', file);
this.project.fileDidChange(vscode_uri_1.default.file(file).toString());
});
watcher.on("renamed", (file, newFile) => {
console.log('Watch event: renamed', file);
this.project.fileWasDeleted(vscode_uri_1.default.file(file).toString());
this.project.fileDidChange(vscode_uri_1.default.file(newFile).toString());
});
...
the result is not satisfactory. For example deletion of enclosing folder doesn't trigger file deletion. Gaze lib used for watching seems quite unreliable in edge-cases.
Also it doesn't handle globs with relative paths (--includes './src/**/*.gql').
Intended outcome:
--watchis able to track added, deleted and renamed files.Actual outcome:
Currently only changes in preexisting files trigger watch.
How to reproduce the issue:
Try to create a query file matching
includespattern.Further info:
There are two parts to this problem:
Watching logic is insufficient (no deletion and rename handling at least):
apollo-tooling/packages/apollo/src/commands/client/codegen.ts
Line 219 in a30f0e1
Even after quick fix I made locally to handle specific cases:
the result is not satisfactory. For example deletion of enclosing folder doesn't trigger file deletion. Gaze lib used for watching seems quite unreliable in edge-cases.
Also it doesn't handle globs with relative paths (
--includes './src/**/*.gql').