multitask icon indicating copy to clipboard operation
multitask copied to clipboard

Multitask file does not execute on vim/neovim save

Open leakec opened this issue 1 year ago • 2 comments

In order to get the multitask file to execute from within vim/neovim I'm currently using the !touch <filename> command from within the editor. The normal save does not trigger the execution.

I've dug into this a little bit and I think it's because the file system watcher is based on notify_debouncer_full, which does not emit Modify events after a Create event. It does emit rename events. I'm curious if touch triggers a rename event somehow, while vim/neovim save does not (they likely just modify the contents).

An additional detail is that is relevant is the file system watcher watches the entire host folder and all sub-directories. This can be quite a lot of files depending on where the host folder is, and is a bit unnecessary. It can also lead to issues, since the file system watcher will recurse through directories, possibly directories the user doesn't have access to, which can lead to errors in the watcher that will ultimately result in the plugin never running the file, no matter how it is modified: touch, save in vim/neovim, etc. I'm mentioning this here, since a good solution will ideally solve both problems.

What I'd really like is to be able to specify a single file to watch and specify that I want to watch for all events, including all Modify events, not just rename events. If I could do this, this would solve both problems.

leakec avatar May 03 '24 15:05 leakec

Regarding the neovim/vim save issue, the save actually triggers a create and delete event rather than an update event. I can modify multitask to monitor create events for the multitask file as well as update events.

I'm going to submit a feature request and then hopefully a PR to modify watch_filesystem to restrict it to a smaller set of folders.

EDIT: Issue opened for watch_filesystem here: https://github.com/zellij-org/zellij/issues/3325

leakec avatar May 04 '24 19:05 leakec

This is solved by https://github.com/imsnif/multitask/commit/a79096cea604a30214829b51294f596d165ab36c, but I'm going to leave this open as a reminder to monitor the PR on the zellij core and push changes to make use of that PR once it is in.

leakec avatar Jun 14 '24 02:06 leakec

Note that the file system watching problem should be resolved using new zellij API rather than by modifying watch_filesystem. Details in the comments of this PR: https://github.com/zellij-org/zellij/pull/3377

leakec avatar Nov 05 '24 15:11 leakec

Note that the file system watching problem should be resolved using new zellij API rather than by modifying watch_filesystem. Details in the comments of this PR: zellij-org/zellij#3377

Even better is to just fix this so it doesn't use watch filesystem. Working on this in the refactor branch currently. Ideally, this refactor should also solve #12 .

leakec avatar Mar 04 '25 01:03 leakec

Note that the file system watching problem should be resolved using new zellij API rather than by modifying watch_filesystem. Details in the comments of this PR: zellij-org/zellij#3377

Even better is to just fix this so it doesn't use watch filesystem. Working on this in the refactor branch currently. Ideally, this refactor should also solve #12 .

I think I've got a working solution to #12 in there directly. I've also opened #14 to track the refactor and ideas. Therefore, I'm going to close this, as the title of this issue has been resolved, and other issues are tracking the other things that popped up in this one.

leakec avatar Apr 04 '25 14:04 leakec