Can I use vscode ExtensionTerminal in Theia?


I’m trying to get my VS Code extension Calva work in Theia. I’m not fully clear about all things that do not work at the moment, but right now I am focusing on the fact that Theia throws errors about the terminal instance being undefined for custom Task I use for starting and controlling a shell process. So I am trying to not use a task for this, but instead an ExtensionTerminal. This works in VS Code, but in Theia it is as if it just creates a regular terminal and thus my child process is never run.

This is my PseudoTerminal code:

import * as vscode from 'vscode';
import * as child from 'child_process';

export interface  JackInTerminalOptions extends vscode.TerminalOptions {
    name: string,
    cwd: string,
    env: { [key: string]: string },
    executable: string,
    args: string[]

export class JackInTerminal implements vscode.Pseudoterminal {
    private writeEmitter = new vscode.EventEmitter<string>();
    onDidWrite: vscode.Event<string> = this.writeEmitter.event;
    private closeEmitter = new vscode.EventEmitter<void>();
    onDidClose: vscode.Event<void> = this.closeEmitter.event;

    private fileWatcher: vscode.FileSystemWatcher | undefined;
    private process: child.ChildProcess;

    constructor(private options: JackInTerminalOptions, private outputChannel: vscode.OutputChannel, private whenStarted: (p: child.ChildProcess) => void) {

    open(initialDimensions: vscode.TerminalDimensions | undefined): void {
        this.outputChannel.appendLine(`Starting Jack-in Terminal: ${this.options.executable} ${this.options.args.join(' ')}`);

    close(): void {;

    handleInput(data: string) {
        let charCode = data.charCodeAt(0);
        if (data === "\r") {
        } else if (charCode < 32) {
  `^${String.fromCharCode(charCode + 64)}`);
            if (charCode === 3) {
        } else {

    private async startClojureProgram(): Promise<child.ChildProcess> {
        return new Promise<child.ChildProcess>((resolve) => {
  `${this.options.executable} ${this.options.args.join(' ')}\r\n`);
            if (this.process && !this.process.killed) {
            this.process = child.spawn(this.options.executable, this.options.args, {
                env: this.options.env,
                cwd: this.options.cwd,
                shell: true
            this.process.on('exit', (status) => {
      `process exited with status: ${status}\r\n`);
            this.process.stdout.on('data', (data) => {

    killProcess(): void {
        if (this.process && !this.process.killed) {

I create an instance of that and then create the terminal like so:

    jackInTerminal = (<any>vscode.window).createTerminal({ name: `Calva Jack-in: ${}`, pty: jackInPTY });

The pseudo terminals are pretty recent in the VS Code Extension API, so maybe Theia does not yet have support?

Hello @PEZ! Thank you for your question.
You’re right, Pseudoterminal API isn’t supported yet in Theia.
There’s a request on GitHub where you can describe your use case to give the request more visibility.
BTW, you can track the current status of supporting VS Code compatible Plugin API in Theia on this site