-
Notifications
You must be signed in to change notification settings - Fork 102
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
Try to rewatch removed files in --attach
#532
base: main
Are you sure you want to change the base?
Conversation
@hbuxiaofei Could you please try whether this PR fixes #530 for you? |
Vim creates a new file inode when modifying files, which results in a 'remove' event. This commit handles this by treating 'remove' events as a trigger for reloads. After sending the reload command, the watcher now tries to watch the same path again, which watches the newly created file.
c7fcc48
to
48ed130
Compare
Yes, this patch does work, but it needs to add the EventKind::Modify(ModifyKind::Metadata(_)) => false,
EventKind::Modify(ModifyKind::Name(_)) => true, Maybe it's because vim creates a temporary .xxx.swp file. And there are some small problems, some warning logs will appear.
|
Thanks for testing!
Hmm, this warning indicates that the re-watching failed, so subsequent file changes will be ignored. So this is problematic. Do the warnings still occur after you added the ModifyKind::Metadata and ModifyKind::Name events? |
After adding the ModifyKind::Metadata and ModifyKind::Name events, the warning will appear. But hot-reloading works good. |
Could you post the relevant parts of your vim config. I'm trying to reproduce this, but I keep getting normal
Adding |
Here is my vim configuration repository: https://github.com/hbuxiaofei/vimll But I don't think it has anything to do with the configuration. I cleared my vim configuration and still received this events:
Vim version :
|
Vim creates a new file inode when modifying files, which results in a 'remove' event. This commit handles this by treating 'remove' events as a trigger for reloads. After sending the reload command, the watcher now tries to watch the same path again, which watches the newly created file.
Fixes #530