Enumerate terminals in extensions API
Asked Answered
P

1

8

I know how to create a new terminal from a VSCode extension using the vscode.window.createTerminal method. This method returns a reference to the terminal so that I can subsequently interact with it, for example, by sending strings to it etc.

I would really like to be able to interact with existing terminals in VSCode but cannot find any APIs to do this. Is it possible to enumerate all open integrated terminals in VSCode?

Piles answered 8/1, 2018 at 17:20 Comment(0)
R
2

VS Code 1.26 added window.terminals. This readonly array allows you to access all terminals

There is also:

  • window.activeTerminal- Currently active terminal or undefined if none.
  • window.onDidChangeActiveTerminal - Event fired when the active terminal changes
  • window.onDidOpenTerminal - Event fired when a new terminal is created (either by an extension or by the user)
Rossiya answered 2/11, 2018 at 0:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.