|
|
|
@ -116,3 +116,24 @@ export async function createTerminal(options: TerminalOptions): Promise<SSHPseud
|
|
|
|
|
};
|
|
|
|
|
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)),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|