handleInput

abstract var handleInput: (data: String) -> Unit?(source)

Implement to handle incoming keystrokes in the terminal or when an extension calls Terminal.sendText. data contains the keystrokes/text serialized into their corresponding VT sequence representation.

Parameters

data

The incoming data.

Example: Echo input in the terminal. The sequence for enter (\r) is translated to CRLF to go to a new line and move the cursor to the start of the line.

const writeEmitter = new vscode.EventEmitter<string>();
const pty: vscode.Pseudoterminal = {
onDidWrite: writeEmitter.event,
open: () => {},
close: () => {},
handleInput: data => writeEmitter.fire(data === '\r' ? '\r\n' : data)
};
vscode.window.createTerminal({ name: 'Local echo', pty });

Online Documentation