How to use @theia/console - 4 common examples

To help you get started, we’ve selected a few @theia/console examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipse-theia / theia / packages / debug / src / browser / console / debug-console-session.ts View on Github external
protected async logOutput(session: DebugSession, event: DebugProtocol.OutputEvent): Promise {
        const body = event.body;
        const { category, variablesReference } = body;
        if (category === 'telemetry') {
            console.debug(`telemetry/${event.body.output}`, event.body.data);
            return;
        }
        const severity = category === 'stderr' ? Severity.Error : event.body.category === 'console' ? Severity.Warning : Severity.Info;
        if (variablesReference) {
            const items = await new ExpressionContainer({ session, variablesReference }).getElements();
            this.items.push(...items);
        } else if (typeof body.output === 'string') {
            for (const line of body.output.split('\n')) {
                this.items.push(new AnsiConsoleItem(line, severity));
            }
        }
        this.fireDidChange();
    }
github eclipse-theia / theia / packages / debug / src / browser / console / debug-console-session.ts View on Github external
appendLine(value: string): void {
        this.items.push(new AnsiConsoleItem(value, Severity.Info));
        this.fireDidChange();
    }
github eclipse-theia / theia / packages / debug / src / browser / console / debug-console-session.ts View on Github external
append(value: string): void {
        if (!value) {
            return;
        }

        const lastItem = this.items.slice(-1)[0];
        if (lastItem instanceof AnsiConsoleItem && lastItem.content === this.uncompletedItemContent) {
            this.items.pop();
            this.uncompletedItemContent += value;
        } else {
            this.uncompletedItemContent = value;
        }

        this.items.push(new AnsiConsoleItem(this.uncompletedItemContent, Severity.Info));
        this.fireDidChange();
    }
github eclipse-theia / theia / packages / debug / src / browser / console / debug-console-contribution.tsx View on Github external
static create(parent: interfaces.Container): ConsoleWidget {
        const inputFocusContextKey = parent.get(InDebugReplContextKey);
        const child = ConsoleWidget.createContainer(parent, {
            ...DebugConsoleContribution.options,
            inputFocusContextKey
        });
        const widget = child.get(ConsoleWidget);
        widget.session = child.get(DebugConsoleSession);
        return widget;
    }

@theia/console

Theia - Console Extension

EPL-2.0
Latest version published 20 days ago

Package Health Score

87 / 100
Full package analysis