-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat: add notify based formatter #510
base: main
Are you sure you want to change the base?
Conversation
ff745b2
to
c3a206c
Compare
walk/watch.go
Outdated
} | ||
|
||
// start watching the path | ||
if err := watcher.Add(fqPath); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does this run? Is it exactly once (per path) on startup? What about the scenario where new files are created after we register all these watches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will run in async mode as soon as we call the Add method, for the moment I've kept it simple so that this only formats file changes and not the initial formatting, but later this would be the preferred behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't think I understand: with the code in this PR, will we start watching files if they're created after the watch starts, or would someone have to restart the watch process to watch those new files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I've just understood what you meant. It continuously monitors file system events from the moment it starts, including the creation and update of all files within the specified paths, without the need to restart the monitoring process.
ec0d6e0
to
ce2aaa0
Compare
Files detected by the walker are not guaranteed to exist when the format, caching or release funcs kicks in. This code captures the creation of IDE swap and temporary files, but if deleted quickly such saving to file in Neovim will result in a crash with file not found. I'm not quite sure how to fix this at the moment, but it shouldn't be hard to find later. |
150bea4
to
b91c5e3
Compare
Close: #509