Add (create)TextTerminal to pseudoTerminal.ts

feature/ssh-config
Kelvin Schoofs 4 years ago
parent 8c0b5c4d1a
commit 5377a58583

@ -116,3 +116,24 @@ export async function createTerminal(options: TerminalOptions): Promise<SSHPseud
}; };
return pseudo; return pseudo;
} }
export interface TextTerminal extends vscode.Pseudoterminal {
write(text: string): void;
close(code?: number): void;
onDidClose: vscode.Event<number>; // Redeclaring that it isn't undefined
onDidOpen: vscode.Event<void>;
}
export function createTextTerminal(initialText?: string): TextTerminal {
const onDidWrite = new vscode.EventEmitter<string>();
const onDidClose = new vscode.EventEmitter<number>();
const onDidOpen = new vscode.EventEmitter<void>();
return {
write: onDidWrite.fire.bind(onDidWrite),
close: onDidClose.fire.bind(onDidClose),
onDidWrite: onDidWrite.event,
onDidClose: onDidClose.event,
onDidOpen: onDidOpen.event,
open: () => initialText && (onDidWrite.fire(initialText), onDidClose.fire(1)),
};
}

Loading…
Cancel
Save