stevearc / overseer.nvim

A task runner and job management plugin for Neovim
MIT License
1.03k stars 50 forks source link

feature request: Global option to turn autostart off completely #245

Open deanishe opened 7 months ago

deanishe commented 7 months ago

Did you check existing requests?

Describe the feature

I would like a simple, global option to disable autostart completely. I don't ever want tasks to run on load, and that is currently difficult to achieve without great effort. In particular, I've had to make a private copy of the resession.nvim plugin.

Provide background

I would like to be able to add tasks like "Publish to Server", but I also don't want to risk such destructive tasks running when I don't expect it.

So I would like to be able to disable autostart completely.

Currently, I am editing tasks, overriding options and re-writing plugins to achieve this. I would prefer the convenience — and especially peace — of mind of a global option to turn autostart off everywhere at once.

What is the significance of this feature?

strongly desired

Additional details

No response

stevearc commented 6 months ago

Presumably when you use :OverseerRun and select the task from the list you would be fine with it running, correct? It sounds like the main situation where you don't want it to autostart is restoring from a session? Are there any other cases?

I ask because there may be a better way to be more targeted about protecting specific sensitive tasks without globally disabling autostart

deanishe commented 6 months ago

Are there any other cases?

Not starting tasks on session auto-load is the main thing, yes.

But generally speaking, I do not want my editor kicking off build jobs just because I opened it.

I would like a global option because auto-starting tasks appears to be a deliberate design goal, and I don't want to be surprised by a new feature that brings its own, new "no autostart" flag with it that I didn't realise I had to set.

there may be a better way to be more targeted about protecting specific sensitive tasks without globally disabling autostart

Personally, I just don't want anything running automatically. The "watch" feature covers my autorun needs perfectly. A global option is the best way to achieve that, imo. Anything else — other than defaulting to no autostart — is more effort and more error prone.

stevearc commented 6 months ago

I added a config option to disable autostart when loading tasks from a bundle. It also applies to the resession.nvim plugin. LMK if this solves your problem

deanishe commented 6 months ago

LMK if this solves your problem

I no longer need my forked plugin, so thanks very much for that 👍

It doesn't really address the more general issue of Overseer running tasks more eagerly than I'd like. It's not possible, AFAIK, to create a task without also immediately running it. (Instead, I have to create a task that does something innocuous, then edit it to set the real command.)

So I would like — generally speaking — the option for task execution to not be coupled with any other operation. Then I can add tasks like "clean all" or "push to live server" ahead of time without having to wait till I actually want to run the task (and generally not worry about the tasks ever running automatically).

stevearc commented 6 months ago

It's not possible, AFAIK, to create a task without also immediately running it

Only sort of true. It's true that if you use :OverseerRun the task is going to be immediately created and executed. However if you want to just create a task you can use the new_task API which doesn't autostart, or you can call run_template directly and pass autostart = false.

Do either of those work for your use case? I'd be very curious if you find yourself wanting to :OverseerRun, select a task, but not start executing it. If that's the case I'd want to hear more about your workflow, because it's a situation I have never considered. From the current description, I don't see the advantage of even creating the "clean all" task until you want to run it.