No file events for undo operations from finder/explorer
Does this issue occur when all extensions are disabled?: No (An extension is needed to create a file watcher and monitor it)
Version: 1.92.2 (user setup) Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9 Date: 2024-08-14T17:29:30.058Z Electron: 30.1.2 ElectronBuildId: 9870757 Chromium: 124.0.6367.243 Node.js: 20.14.0 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.22631
Steps to Reproduce:
- Write a simple extension that sets up a fileWatcher at the root of the workspace, with
workspace.createFileSystemWatcher, and registers foronDidCreate(or use the C/C++ Extension with"C_Cpp.loggingLevel": "Debug"set, and monitor the C/C++ output channel for log messages that refer tofileCreate. - Open the workspace and create a subdirectory within it, and a file in that subdirectory (i.e.
test.h). - In the File Explorer (on Windows, or Finder on macOS) delete that subdirectory. (If using the C/C++ Extension, you should see a delete for just the directory, which is fine, since delete of a directory implies its contents are deleted).
- Then, also in the File Explorer (on Windows, or Finder on macOS), "Undo" that deletion.
Seeing: An onDidCreate is generated for the restored directory but NOT for any of it's contents. Expected: We should get a file creation notification for all newly discovered files, including those in a directory restored by an undo operation.
We're seeing the same issue on both Windows and macOS. The expectation is that the fileWatcher should inform us when any files or folders are created/deleted/changed under the tree we're monitoring, and not require us to recursively scan the contents of newly added directories ourselves (and only in this odd scenario).
Note that this does not happen when copying a directory full of files into the workspace. In that case, we get notifications for all contents.
https://github.com/user-attachments/assets/56ad4e94-d77e-479f-bbbc-c5907ae7f70e
Reported as upstream, its likely that the OS watcher methods (ReadDirectoryChangesW, fsevents) are not even providing this information so its hard to workaround this: https://github.com/parcel-bundler/watcher/issues/185
I am closing this issue, given the reported upstream. As we stay with parcel watcher, fixes have to go there and we are actively contributing.