Skip to content

Clean up buffers opened by open_output.lua on reset - #500

Open
briandipalma wants to merge 2 commits into
stevearc:masterfrom
briandipalma:patch-3
Open

Clean up buffers opened by open_output.lua on reset#500
briandipalma wants to merge 2 commits into
stevearc:masterfrom
briandipalma:patch-3

Conversation

@briandipalma

Copy link
Copy Markdown

Obviously I can add a flag to control this but this is very handy when running tasks over and over again.

@github-actions
github-actions Bot requested a review from stevearc February 17, 2026 15:10

@stevearc stevearc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if this was behind a configuration option. We should also use nvim_buf_delete instead of building a command string, and we should guard it with checks to ensure that the buffer exists and is valid so we don't need a pcall.

@briandipalma

Copy link
Copy Markdown
Author

Thanks for the review, sorry for the delay, I hope these changes are what you had in mind.

@stevearc

stevearc commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Hmmm...the code now is I think the correct shape to do what the PR says, but I'd like to dig in a little bit more because I'm getting a feeling that a different approach may fix your issue in a more thorough way.

Can you give me a bit more detail on the workflow that you're using and the problem that you're trying to solve? My best guess is that you're restarting tasks often and some of their buffers get "orphaned" and stick around, never to be cleaned up. Is this accurate?

@briandipalma

Copy link
Copy Markdown
Author

Yes. I have a test task that always opens output.

I did this as some of our package tests could take 30+ seconds to run and I wanted feedback.
When the errors populated a quickfix I'd then go through the quickfix and fix the failures.
Then I'd need to OverseerTaskAction and restart the test task so the quickfix window would clear down otherwise the previous failures would stay in the quickfix.

Doing that would result in multiple output windows all showing the new test run.

@briandipalma

Copy link
Copy Markdown
Author

Like so:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants