compiler.nvim icon indicating copy to clipboard operation
compiler.nvim copied to clipboard

Can we jump to the task output by default?

Open aaronmcadam opened this issue 1 year ago • 3 comments

First of all, thank you so much for an awesome plugin!

I'd like to build and run and have the active Overseer item automatically be the task output without needing to navigate to it manually.

CleanShot 2024-02-02 at 21 22 15@2x

See the attached video to see what I mean: https://github.com/Zeioth/compiler.nvim/assets/37928/ff4a9890-de92-4bb7-8dd0-e412494c5210

aaronmcadam avatar Feb 02 '24 21:02 aaronmcadam

Hey @aaronmcadam I realize, and what you say makes total sense. It's not trivial to achieve though, as we use overseer.nvim as task runner. I don't think the orchestrator strategy we use has a option for this.

We can't really use pure tasks instead of a orchestrator because most of our cases of use need to run tasks secuencially like compile → run, which requires the overseer orchestrator.

Give me some time to research alternatives. This would be actually cool to achieve. I realize if you need to compile often, it can tedious having to press down every time.

Zeioth avatar Feb 02 '24 22:02 Zeioth

@Zeioth thanks for the background info, that explains the subgrouping very well. For recompiling, it's not too bad because I can set the task to watch mode to rerun when I change the code. So I'm happy for now. Let me know if I can help you test out any ideas you have though!

aaronmcadam avatar Feb 02 '24 22:02 aaronmcadam

Now that I remember: this was the original behavior of this plugin actually. The change has been upstream on overseer in how it order orchestrated tasks. I'm gonna ask Steve. screenshot

EDIT: Tracking https://github.com/stevearc/overseer.nvim/discussions/262

Zeioth avatar Feb 02 '24 23:02 Zeioth

PR sent, waiting for feedback. https://github.com/stevearc/overseer.nvim/pull/299

Zeioth avatar May 31 '24 14:05 Zeioth

Alternative approach added to overseer:

-- define the componen `custom_tasklist`.
-- when a task start, auto open the tasklist and focus the first child.
require("overseer").register_alias("custom_tasklist", {
  "default",
  { "open_output", on_start = true, on_complete = "never" },
})

We add that to init, and then we can use it on the backend like in the next example

local task = overseer.new_task({
  name = "- Lua interpreter",
  strategy = { "orchestrator",
    tasks = {{ "shell", name = "- Run this file → " .. current_file,
      cmd =  "lua " .. current_file ..                                   -- run (interpreted)
            " && echo " .. current_file ..                               -- echo
            " && echo \"" .. final_message .. "\"",
      components = { "custom_tasklist" }
    },},},})

Hopefully, we can convince steve to make this the default behavior, but even if we can't, at least this UX issue is fixable now, and we should be able to ship it in the next version.

Zeioth avatar Jun 06 '24 11:06 Zeioth

Thanks for the hard work and collaboration on this @Zeioth @stevearc ❤️

aaronmcadam avatar Jun 10 '24 08:06 aaronmcadam