How to use @theia/languages - 10 common examples

To help you get started, we’ve selected a few @theia/languages 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 / typehierarchy / src / browser / tree / typehierarchy-tree.ts View on Github external
export function create(item: TypeHierarchyItem, direction: TypeHierarchyDirection, resolved: boolean = true): Node {
            const items = TypeHierarchyDirection.Children === direction ? item.children : item.parents;
            if (items && items.length > 0) {
                // If the server sent more levels than requested, use them.
                resolved = true;
            }
            const node = {
                id: v4(),
                name: item.name,
                description: item.detail,
                parent: undefined,
                location: Location.create(item.uri, item.selectionRange),
                resolved,
                children: items ? items.map(child => create(child, direction, false)) : [],
                expanded: false,
                visible: true,
                selected: false,
                kind: item.kind,
github eclipse-theia / theia / packages / java / src / browser / java-protocol.ts View on Github external
}

export namespace StatusNotification {
    export const type = new NotificationType('language/status');
}

export interface ActionableMessage {
    severity: MessageType;
    message: string;
    // tslint:disable-next-line:no-any
    data?: any;
    commands?: Command[];
}

export namespace ClassFileContentsRequest {
    export const type = new RequestType('java/classFileContents');
}

export namespace ActionableNotification {
    export const type = new NotificationType('language/actionableNotification');
}

export enum CompileWorkspaceStatus {
    FAILED = 0,
    SUCCEED = 1,
    WITHERROR = 2,
    CANCELLED = 3,
}

export namespace CompileWorkspaceRequest {
    export const type = new RequestType('java/buildWorkspace');
}
github eclipse-theia / theia / packages / java / src / browser / java-protocol.ts View on Github external
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
 * with the GNU Classpath Exception which is available at
 * https://www.gnu.org/software/classpath/license.html.
 *
 * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
 ********************************************************************************/

import { RequestType, NotificationType, TextDocumentIdentifier, Command, MessageType, ExecuteCommandParams } from '@theia/languages/lib/browser';

export interface StatusReport {
    message: string;
    type: string;
}

export namespace StatusNotification {
    export const type = new NotificationType('language/status');
}

export interface ActionableMessage {
    severity: MessageType;
    message: string;
    // tslint:disable-next-line:no-any
    data?: any;
    commands?: Command[];
}

export namespace ClassFileContentsRequest {
    export const type = new RequestType('java/classFileContents');
}

export namespace ActionableNotification {
    export const type = new NotificationType('language/actionableNotification');
github eclipse-theia / theia / packages / java / src / browser / java-protocol.ts View on Github external
}

export interface ActionableMessage {
    severity: MessageType;
    message: string;
    // tslint:disable-next-line:no-any
    data?: any;
    commands?: Command[];
}

export namespace ClassFileContentsRequest {
    export const type = new RequestType('java/classFileContents');
}

export namespace ActionableNotification {
    export const type = new NotificationType('language/actionableNotification');
}

export enum CompileWorkspaceStatus {
    FAILED = 0,
    SUCCEED = 1,
    WITHERROR = 2,
    CANCELLED = 3,
}

export namespace CompileWorkspaceRequest {
    export const type = new RequestType('java/buildWorkspace');
}

export namespace ExecuteClientCommand {
    export const type = new RequestType('workspace/executeClientCommand');
}
github eclipse-theia / theia / packages / typehierarchy / src / browser / tree / typehierarchy-tree.ts View on Github external
export function is(node: TreeNode | undefined): node is RootNode {
            if (Node.is(node) && 'direction' in node) {
                // tslint:disable-next-line:no-any
                const { direction } = (node as any);
                return direction === TypeHierarchyDirection.Children || direction === TypeHierarchyDirection.Parents;
            }
            return false;
        }
github eclipse-theia / theia / packages / debug / src / browser / console / debug-console-session.ts View on Github external
init(): void {
        this.toDispose.push(this.manager.onDidCreateDebugSession(session => {
            if (this.manager.sessions.length === 1) {
                this.clear();
            }
            session.on('output', event => this.logOutput(session, event));
        }));
        this.completionKinds.set('method', CompletionItemKind.Method);
        this.completionKinds.set('function', CompletionItemKind.Function);
        this.completionKinds.set('constructor', CompletionItemKind.Constructor);
        this.completionKinds.set('field', CompletionItemKind.Field);
        this.completionKinds.set('variable', CompletionItemKind.Variable);
        this.completionKinds.set('class', CompletionItemKind.Class);
        this.completionKinds.set('interface', CompletionItemKind.Interface);
        this.completionKinds.set('module', CompletionItemKind.Module);
        this.completionKinds.set('property', CompletionItemKind.Property);
        this.completionKinds.set('unit', CompletionItemKind.Unit);
        this.completionKinds.set('value', CompletionItemKind.Value);
        this.completionKinds.set('enum', CompletionItemKind.Enum);
        this.completionKinds.set('keyword', CompletionItemKind.Keyword);
        this.completionKinds.set('snippet', CompletionItemKind.Snippet);
        this.completionKinds.set('text', CompletionItemKind.Text);
        this.completionKinds.set('color', CompletionItemKind.Color);
        this.completionKinds.set('file', CompletionItemKind.File);
        this.completionKinds.set('reference', CompletionItemKind.Reference);
        this.completionKinds.set('customcolor', CompletionItemKind.Color);
        if (this.languages.registerCompletionItemProvider) {
            this.toDispose.push(this.languages.registerCompletionItemProvider([DebugConsoleSession.uri], {
                provideCompletionItems: params => this.completions(params)
github eclipse-theia / theia / packages / debug / src / browser / console / debug-console-session.ts View on Github external
init(): void {
        this.toDispose.push(this.manager.onDidCreateDebugSession(session => {
            if (this.manager.sessions.length === 1) {
                this.clear();
            }
            session.on('output', event => this.logOutput(session, event));
        }));
        this.completionKinds.set('method', CompletionItemKind.Method);
        this.completionKinds.set('function', CompletionItemKind.Function);
        this.completionKinds.set('constructor', CompletionItemKind.Constructor);
        this.completionKinds.set('field', CompletionItemKind.Field);
        this.completionKinds.set('variable', CompletionItemKind.Variable);
        this.completionKinds.set('class', CompletionItemKind.Class);
        this.completionKinds.set('interface', CompletionItemKind.Interface);
        this.completionKinds.set('module', CompletionItemKind.Module);
        this.completionKinds.set('property', CompletionItemKind.Property);
        this.completionKinds.set('unit', CompletionItemKind.Unit);
        this.completionKinds.set('value', CompletionItemKind.Value);
        this.completionKinds.set('enum', CompletionItemKind.Enum);
        this.completionKinds.set('keyword', CompletionItemKind.Keyword);
        this.completionKinds.set('snippet', CompletionItemKind.Snippet);
        this.completionKinds.set('text', CompletionItemKind.Text);
        this.completionKinds.set('color', CompletionItemKind.Color);
        this.completionKinds.set('file', CompletionItemKind.File);
        this.completionKinds.set('reference', CompletionItemKind.Reference);
        this.completionKinds.set('customcolor', CompletionItemKind.Color);
github eclipse-theia / theia / packages / debug / src / browser / console / debug-console-session.ts View on Github external
init(): void {
        this.toDispose.push(this.manager.onDidCreateDebugSession(session => {
            if (this.manager.sessions.length === 1) {
                this.clear();
            }
            session.on('output', event => this.logOutput(session, event));
        }));
        this.completionKinds.set('method', CompletionItemKind.Method);
        this.completionKinds.set('function', CompletionItemKind.Function);
        this.completionKinds.set('constructor', CompletionItemKind.Constructor);
        this.completionKinds.set('field', CompletionItemKind.Field);
        this.completionKinds.set('variable', CompletionItemKind.Variable);
        this.completionKinds.set('class', CompletionItemKind.Class);
        this.completionKinds.set('interface', CompletionItemKind.Interface);
        this.completionKinds.set('module', CompletionItemKind.Module);
        this.completionKinds.set('property', CompletionItemKind.Property);
        this.completionKinds.set('unit', CompletionItemKind.Unit);
        this.completionKinds.set('value', CompletionItemKind.Value);
        this.completionKinds.set('enum', CompletionItemKind.Enum);
        this.completionKinds.set('keyword', CompletionItemKind.Keyword);
        this.completionKinds.set('snippet', CompletionItemKind.Snippet);
        this.completionKinds.set('text', CompletionItemKind.Text);
        this.completionKinds.set('color', CompletionItemKind.Color);
        this.completionKinds.set('file', CompletionItemKind.File);
        this.completionKinds.set('reference', CompletionItemKind.Reference);
        this.completionKinds.set('customcolor', CompletionItemKind.Color);
        if (this.languages.registerCompletionItemProvider) {
github eclipse-theia / theia / packages / debug / src / browser / console / debug-console-session.ts View on Github external
init(): void {
        this.toDispose.push(this.manager.onDidCreateDebugSession(session => {
            if (this.manager.sessions.length === 1) {
                this.clear();
            }
            session.on('output', event => this.logOutput(session, event));
        }));
        this.completionKinds.set('method', CompletionItemKind.Method);
        this.completionKinds.set('function', CompletionItemKind.Function);
        this.completionKinds.set('constructor', CompletionItemKind.Constructor);
        this.completionKinds.set('field', CompletionItemKind.Field);
        this.completionKinds.set('variable', CompletionItemKind.Variable);
        this.completionKinds.set('class', CompletionItemKind.Class);
        this.completionKinds.set('interface', CompletionItemKind.Interface);
        this.completionKinds.set('module', CompletionItemKind.Module);
        this.completionKinds.set('property', CompletionItemKind.Property);
        this.completionKinds.set('unit', CompletionItemKind.Unit);
        this.completionKinds.set('value', CompletionItemKind.Value);
        this.completionKinds.set('enum', CompletionItemKind.Enum);
        this.completionKinds.set('keyword', CompletionItemKind.Keyword);
        this.completionKinds.set('snippet', CompletionItemKind.Snippet);
        this.completionKinds.set('text', CompletionItemKind.Text);
        this.completionKinds.set('color', CompletionItemKind.Color);
        this.completionKinds.set('file', CompletionItemKind.File);
        this.completionKinds.set('reference', CompletionItemKind.Reference);
github eclipse-theia / theia / packages / debug / src / browser / console / debug-console-session.ts View on Github external
init(): void {
        this.toDispose.push(this.manager.onDidCreateDebugSession(session => {
            if (this.manager.sessions.length === 1) {
                this.clear();
            }
            session.on('output', event => this.logOutput(session, event));
        }));
        this.completionKinds.set('method', CompletionItemKind.Method);
        this.completionKinds.set('function', CompletionItemKind.Function);
        this.completionKinds.set('constructor', CompletionItemKind.Constructor);
        this.completionKinds.set('field', CompletionItemKind.Field);
        this.completionKinds.set('variable', CompletionItemKind.Variable);
        this.completionKinds.set('class', CompletionItemKind.Class);
        this.completionKinds.set('interface', CompletionItemKind.Interface);
        this.completionKinds.set('module', CompletionItemKind.Module);
        this.completionKinds.set('property', CompletionItemKind.Property);
        this.completionKinds.set('unit', CompletionItemKind.Unit);
        this.completionKinds.set('value', CompletionItemKind.Value);
        this.completionKinds.set('enum', CompletionItemKind.Enum);
        this.completionKinds.set('keyword', CompletionItemKind.Keyword);
        this.completionKinds.set('snippet', CompletionItemKind.Snippet);
        this.completionKinds.set('text', CompletionItemKind.Text);
        this.completionKinds.set('color', CompletionItemKind.Color);
        this.completionKinds.set('file', CompletionItemKind.File);
        this.completionKinds.set('reference', CompletionItemKind.Reference);
        this.completionKinds.set('customcolor', CompletionItemKind.Color);
        if (this.languages.registerCompletionItemProvider) {
            this.toDispose.push(this.languages.registerCompletionItemProvider([DebugConsoleSession.uri], {
                provideCompletionItems: params => this.completions(params)
            }, '.'));