Interface Pseudoterminal

Defines the interface of a terminal pty, enabling extensions to control a terminal.

interface Pseudoterminal {
    onDidChangeName?: Event<string>;
    onDidClose?: Event<number | void>;
    onDidOverrideDimensions?: Event<undefined | TerminalDimensions>;
    onDidWrite: Event<string>;
    close(): void;
    handleInput?(data): void;
    open(dimensions): void;
    setDimensions?(dimensions): void;
}

Properties

onDidChangeName?: Event<string>

An event that when fired allows changing the name of the terminal.

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

Example: Change the terminal name to "My new terminal".

const writeEmitter = new vscode.EventEmitter<string>();
const changeNameEmitter = new vscode.EventEmitter<string>();
const pty: vscode.Pseudoterminal = {
onDidWrite: writeEmitter.event,
onDidChangeName: changeNameEmitter.event,
open: () => changeNameEmitter.fire('My new terminal'),
close: () => {}
};
vscode.window.createTerminal({ name: 'My terminal', pty });
onDidClose?: Event<number | void>

An event that when fired will close the pty.

onDidOverrideDimensions?: Event<undefined | TerminalDimensions>

An event that when fired allows resizing the terminal.

onDidWrite: Event<string>

An event that when fired will write data to the terminal.

Methods

  • Implement to handle inputting data in the terminal.

    Parameters

    • data: string

      The inputting data.

    Returns void