Clean up buffers opened by open_output.lua on reset - #500
Conversation
stevearc
left a comment
There was a problem hiding this comment.
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.
|
Thanks for the review, sorry for the delay, I hope these changes are what you had in mind. |
|
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? |
|
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. Doing that would result in multiple output windows all showing the new test run. |

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