• Public
  • Public/Protected
  • All

Class TerminalWidget Abstract

Terminal UI widget.




  • Parameters

    • Optional options: IOptions

    Returns TerminalWidget


dimensions: TerminalDimensions
exitStatus: undefined | TerminalExitStatus
hiddenFromUser: boolean

Terminal widget can be hidden from users until explicitly shown once.

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

The position of the terminal widget.

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
  • selectAll(): 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