-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow extensions to access all terminals via API #13267
Comments
What do you think @jrieken? |
Not yet sold on the importance and future-proof of that API. I would suggest to hold back with this API until the discussion about moving terminals into the editor space comes to an result (we recently talked about that in a UX sync). Then we might have a different set of requirements and limitations. |
I was at one of those meetings that talked about that and it was shot down pretty hard, it would make management of terminals much more difficult and blur the lines between a panel and an editor. Would that really change the requirements though, this is just adding an open event and a list of terminals which would still be valid regardless of where a terminal was? |
I am pretty sure the discussion will come again once we introduce horizontal editors. Not saying we merge panels and editors (errors, output, debug should stay there), but I have the (strong) feeling that terminal a much more like editors (I create/dispose them, I manage them) and for editors we have the far superior story for managing/navigating them. Like html-preview and extension-editors, terminal would greatly benefit from that IMO. Taking about the API: It might not look any different but I just want to be careful and not rush into something we cannot change again. I don't see strong feature pressure for this so I would wait for the bigger workbench UX changes to land first. |
Wouldn't |
@jrieken for the problems use case you would want to watch the output of terminals in the background. When working on VS Code for example I have 2 terminals; @dbaeumer is this right? You would want to watch any terminal, not just ones that were launched via an extension? |
I would like to watch the output of potential all terminals. However for the input I only need the active one. The user can only type in one terminal anyways. |
@jrieken For an example of how the current behavior is sub-optimal see PowerShell/vscode-powershell#604 We would love to see something like this for the PowerShell extension if it allowed us to bypass that initial, useless terminal startup. We now have an "integrated console" that effectively replaces the Debug Console at debug time and provides a REPL experience at edit time. That is, our integrated console allows the user to play around in the same PowerShell process that hosts both the language and debug services. This gives a nice SmallTalk-like REPL experience that spans edit & debug. The only way to plumb this in was to add another terminal type - |
Any chance we could see what shell exe the terminal launched? I know it's a bit of a grey area, but might be nice for determining whether I should kill one of the terminals in favor of the PowerShell Integrated Console. |
@daviwil the usage of it would probably be pretty limited, if you're just tracking the initial panel restore you could probably get around it some other way. I'm extra hesitant to add since it could be misleading, say if someone opens cmd inside powershell. |
Sounds good, I definitely understand not wanting to add something of limited value! |
Hi, I'm facing a situation where I 'll need to create one terminal for every root folder (selected project) because the commands I'm registering need to run in its own root folder terminal. But I would like to create the terminal only once, but don't know how to retrieve an already created one. |
Has there been any updates as off 2018? |
@hdsantos89 nothing other than more interest in getting at the PID of all terminals in #42521 |
To give a summary of the needs for this API:
Let me know if I missed anything |
Exactly, other than being pretty ugly and most of the times inefficient there are no guarantees this will even work (maybe the user has 26+ terminals open for some reason). A few more things that could be done with access to all terminals:
The proposed APIs look as future proof as they can possibly be to me. |
This is needed for #46192 |
This is landing in tomorrow's insiders as a proposed API: export namespace window {
/**
* The currently active terminals or an empty array.
*
* @readonly
*/
export let terminals: Terminal[];
/**
* An [event](#Event) which fires when a terminal has been created, either through the
* [createTerminal](#window.createTerminal) API or commands.
*/
export const onDidOpenTerminal: Event<Terminal>;
} |
To give extensions more control over the terminal panel I'm proposing the following:
A solid use case for this is to represent the terminals as tabs somewhere in the UI https://github.com/Tyriar/vscode-terminal-tabs
The text was updated successfully, but these errors were encountered: