VS Code API
    Preparing search index...

    Interface Terminal

    An individual terminal instance within the integrated terminal.

    interface Terminal {
        creationOptions: Readonly<TerminalOptions | ExtensionTerminalOptions>;
        exitStatus: TerminalExitStatus | undefined;
        name: string;
        processId: Thenable<number | undefined>;
        shellIntegration: TerminalShellIntegration | undefined;
        state: TerminalState;
        dispose(): void;
        hide(): void;
        sendText(text: string, shouldExecute?: boolean): void;
        show(preserveFocus?: boolean): void;
    }
    Index

    Properties

    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.

    exitStatus: TerminalExitStatus | undefined

    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}`);
    }
    });
    name: string

    The name of the terminal.

    processId: Thenable<number | undefined>

    The process ID of the shell process.

    shellIntegration: TerminalShellIntegration | undefined

    An object that contains shell integration-powered features for the terminal. This will always be undefined immediately after the terminal is created. Listen to window.onDidChangeTerminalShellIntegration to be notified when shell integration is activated for a terminal.

    Note that this object may remain undefined if shell integration never activates. For example Command Prompt does not support shell integration and a user's shell setup could conflict with the automatic shell integration activation.

    The current state of the Terminal.

    Methods

    • Dispose and free associated resources.

      Returns void

    • Hide the terminal panel if this terminal is currently showing.

      Returns 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.

      • OptionalshouldExecute: boolean

        Indicates that the text being sent should be executed rather than just inserted in the terminal. The character(s) added are \n or \r\n, depending on the platform. This defaults to true.

      Returns void

    • Show the terminal panel and reveal this terminal in the UI.

      Parameters

      • OptionalpreserveFocus: boolean

        When true the terminal will not take focus.

      Returns void