Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming a file does not returns "RENAMED" (3) action #78

Open
andersr opened this issue Jun 27, 2019 · 1 comment
Open

Renaming a file does not returns "RENAMED" (3) action #78

andersr opened this issue Jun 27, 2019 · 1 comment

Comments

@andersr
Copy link

andersr commented Jun 27, 2019

When renaming a file, no RENAMED (3) action is returned.
Instead a MODIFIED (2) action and a DELETED (1) action is returned.

events:  [
  {
    action: 2,
    directory: '/Users/andersjramsay/dev/testing_project/ctf_test_project/src',
    file: 'initialFOO.ts'
  },
  {
    action: 1,
    directory: '/Users/andersjramsay/dev/testing_project/ctf_test_project/src',
    file: 'initial.ts'
  }
]

I created a minimal repo which reproduces the above: https://github.com/andersr/filewatcher-test
Running on OSX, using Node v12.4.0

@mikejav
Copy link

mikejav commented Sep 14, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants