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.
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.
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.
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.
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. |
b91c5e3 to
92b1a24
Compare
|
After careful consideration, it might be more interesting to let a higher-level tool manage the lifecycle, including the watch. |
Close: #509
Stack created with Sapling. Best reviewed with ReviewStack.