• Public
  • Public/Protected
  • All

Class TerminalWidget Abstract

Terminal UI widget.




  • Construct a new widget.


    • Optional options: IOptions

      The options for initializing the widget.

    Returns TerminalWidget


dimensions: TerminalDimensions
exitStatus: undefined | TerminalExitStatus
kind: string

Terminal kind that indicates whether a terminal is created by a user or by some extension for a user

lastCwd: URI

The last CWD assigned to the terminal, useful when attempting getCwdURI on a task terminal fails

onData: Event<string>

Event that fires when the terminal input data

onDidOpen: Event<void>

Event that fires when the terminal is connected or reconnected

onDidOpenFailure: Event<void>

Event that fires when the terminal fails to connect or reconnect

onKey: Event<{ domEvent: KeyboardEvent; key: string }>

Event that fires when the terminal receives a key event.

onSizeChanged: Event<{ cols: number; rows: number }>

Event that fires when the terminal size changed

onTerminalDidClose: Event<TerminalWidget>

Event which fires when terminal did closed. Event value contains closed terminal widget definition.

processId: Promise<number>
processInfo: Promise<TerminalProcessInfo>

Get the current executable and arguments.

terminalId: number


  • clearOutput(): void
  • executeCommand(commandOptions: CommandLineOptions): Promise<void>
  • Resolves when the command is successfully sent, this doesn't mean that it was evaluated. Might reject if terminal wasn't properly started yet.

    Note that this method will try to escape your arguments as if it was someone inputting everything in a shell.

    Supported shells: bash, cmd.exe, wsl.exe, pwsh/powershell.exe


    • commandOptions: CommandLineOptions

    Returns Promise<void>

  • hasChildProcesses(): Promise<boolean>
  • resetTerminal(): void
  • resize(cols: number, rows: number): void
  • scrollLineDown(): void
  • scrollLineUp(): void
  • scrollPageDown(): void
  • scrollPageUp(): void
  • scrollToBottom(): void
  • scrollToTop(): void
  • sendText(text: string): void
  • setTitle(title: string): void
  • start(id?: number): Promise<number>
  • waitOnExit(waitOnExit?: string | boolean): void
  • write(data: string): void
  • writeLine(line: string): void