VSCode-Logger API - v1.7.3
    Preparing search index...

    Class SshTerminalSession

    Pseudoterminal that proxies input/output to an SSH shell session.

    Implements

    • Pseudoterminal
    Index

    Constructors

    • Creates a new SSH terminal session for the given device.

      Parameters

      • device: EmbeddedDevice

        The device configuration to connect to.

      • context: ExtensionContext

        The extension context for secret storage access.

      • OptionalinitialPath: string

        Optional working directory to open on connect.

      Returns SshTerminalSession

    Properties

    onDidClose: Event<void> = ...

    An event that when fired will signal that the pty is closed and dispose of the terminal.

    Events fired before Pseudoterminal.open is called will be be ignored.

    A number can be used to provide an exit code for the terminal. Exit codes must be positive and a non-zero exit codes signals failure which shows a notification for a regular terminal and allows dependent tasks to proceed when used with the CustomExecution API.

    Example: Exit the terminal when "y" is pressed, otherwise show a notification.

    const writeEmitter = new vscode.EventEmitter<string>();
    const closeEmitter = new vscode.EventEmitter<void>();
    const pty: vscode.Pseudoterminal = {
    onDidWrite: writeEmitter.event,
    onDidClose: closeEmitter.event,
    open: () => writeEmitter.fire('Press y to exit successfully'),
    close: () => {},
    handleInput: data => {
    if (data !== 'y') {
    vscode.window.showInformationMessage('Something went wrong');
    }
    closeEmitter.fire();
    }
    };
    const terminal = vscode.window.createTerminal({ name: 'Exit example', pty });
    terminal.show(true);
    onDidWrite: Event<string> = ...

    An event that when fired will write data to the terminal. Unlike Terminal.sendText which sends text to the underlying child pseudo-device (the child), this will write the text to parent pseudo-device (the terminal itself).

    Note writing \n will just move the cursor down 1 row, you need to write \r as well to move the cursor to the left-most cell.

    Events fired before Pseudoterminal.open is called will be be ignored.

    Example: Write red text to the terminal

    const writeEmitter = new vscode.EventEmitter<string>();
    const pty: vscode.Pseudoterminal = {
    onDidWrite: writeEmitter.event,
    open: () => writeEmitter.fire('\x1b[31mHello world\x1b[0m'),
    close: () => {}
    };
    vscode.window.createTerminal({ name: 'My terminal', pty });

    Example: Move the cursor to the 10th row and 20th column and write an asterisk

    writeEmitter.fire('\x1b[10;20H*');
    

    Methods

    • Closes the terminal session and releases resources.

      Returns void

    • Handles user input by forwarding it to the remote shell.

      Parameters

      • data: string

        Input text entered by the user.

      Returns void

    • Opens the pseudoterminal and initiates the SSH connection.

      Parameters

      • OptionalinitialDimensions: TerminalDimensions

        Terminal dimensions supplied by VS Code.

      Returns void

    • Updates the remote shell when the terminal dimensions change.

      Parameters

      • dimensions: TerminalDimensions

        The new terminal dimensions.

      Returns void