Open andersr opened 5 years ago
I'm very discouraged because of this problem. I just wanted to use nsfw for rename detection. I'm currently using a workaround where I observe on creating a file and then watch for deleting with tiny timeout. It seems that the rename works in this way on any system.
this.watcher.onDidCreate((createdFileUri) => {
const onDeleteWatcher = this.watcher.onDidDelete((deletedFileUri) => {
// my onRename handler
});
setTimeout(() => {
onDeleteWatcher.dispose();
}, 100);
});
Above example uses VS Code built in FileSystemWatcher.
When renaming a file, no RENAMED (3) action is returned. Instead a MODIFIED (2) action and a DELETED (1) action is returned.
I created a minimal repo which reproduces the above: https://github.com/andersr/filewatcher-test Running on OSX, using Node v12.4.0