Options
All
  • Public
  • Public/Protected
  • All
Menu

An individual terminal instance within the integrated terminal.

层级

  • Terminal

索引

Properties(4)

Methods(4)

Properties(4)

Readonly name

name: string

The name of the terminal.

Readonly processId

processId: Thenable<undefined | number>

The process ID of the shell process.

Readonly creationOptions

creationOptions: Readonly<TerminalOptions | ExtensionTerminalOptions>

The object used to initialize the terminal, this is useful for example to detecting the shell type of when the terminal was not launched by this extension or for detecting what folder the shell was launched in.

Readonly exitStatus

exitStatus: undefined | TerminalExitStatus

The exit status of the terminal, this will be undefined while the terminal is active.

Example: Show a notification with the exit code when the terminal exits with a non-zero exit code.

window.onDidCloseTerminal(t => {
  if (t.exitStatus && t.exitStatus.code) {
      vscode.window.showInformationMessage(`Exit code: ${t.exitStatus.code}`);
  }
});

Methods(4)

sendText

  • sendText(text: string, addNewLine?: boolean): void
  • Send text to the terminal. The text is written to the stdin of the underlying pty process (shell) of the terminal.

    Parameters

    • text: string

      The text to send.

    • Optional addNewLine: boolean

      Whether to add a new line to the text being sent, this is normally required to run a command in the terminal. The character(s) added are \n or \r\n depending on the platform. This defaults to true.

    Returns void

show

  • show(preserveFocus?: boolean): void
  • Show the terminal panel and reveal this terminal in the UI.

    Parameters

    • Optional preserveFocus: boolean

      When true the terminal will not take focus.

    Returns void

hide

  • hide(): void
  • Hide the terminal panel if this terminal is currently showing.

    Returns void

dispose

  • dispose(): void
  • Dispose and free associated resources.

    Returns void

友链:VS Code 中文文档 | VS Code 官网文档 | VS Code 扩展市场

Generated by TypeDoc. Maintained by 洛竹