feat: allow commands to be run in the last active terminal #43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses some of the comments in #12 (but not all of them!).
Basically, I haven't had time to fully explore all the possibilities here, so this feature is intended to address only the most basic requirements.
A new setting
task.outputTo
has been added which can be set tooutput
orterminal
. I have not changed the default for now as there likely to be more changes to the terminal output in the future. Users of theterminal
option should consider this experimental and subject to change. The semantics of the feature are described below:If you have
task.outputTo
set tooutput
(default), then the extension will behave in the same way that it did before this change. i.e. It will output Task commands and their outputs to the output panel. The only small change here is that ANSI codes will now be stripped from the output as colors cannot be rendered in this panel.If you have
task.outputTo
set toterminal
, Task will grab the last active terminal and send the command to that instead. If no active terminal is found, we will create one and focus it. It is super important to note that we are not doing ANY checking as to whether or not that terminal has an active process (I'm not sure if this is even possible with the VSCode API), so if you are already running a command or a TUI etc, you definitely want to be careful or you're going to end up sending a bunch of text into whatever TUI you have running.