How to use the @theia/languages/lib/browser.Range.create function in @theia/languages

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 / debug / src / browser / console / debug-console-session.ts View on Github external
protected asCompletionItem(document: TextDocument, position: Position, prefixLength: number, item: DebugProtocol.CompletionItem): CompletionItem {
        const { label, text, type, length } = item;
        const newText = text || label;
        const start = document.positionAt(document.offsetAt(position) - (length || prefixLength));
        const replaceRange = Range.create(start, position);
        const textEdit = TextEdit.replace(replaceRange, newText);
        return {
            label,
            textEdit,
            kind: this.completionKinds.get(type)
        };
    }
github eclipse-theia / theia / packages / preview / src / browser / preview-widget.ts View on Github external
protected fireDidDoubleClickToSourceLine(line: number): void {
        if (!this.resource) {
            return;
        }
        this.onDidDoubleClickEmitter.fire({
            uri: this.resource.uri.toString(),
            range: Range.create({ line, character: 0 }, { line, character: 0 })
        });
    }
github ballerina-platform / ballerina-lang / tool-plugins / theia / ballerina-extension / src / browser / ballerina-language-client.ts View on Github external
const revealRangeInEditor = (editor: TextEditor) => {
            const { start, end } = params.range;
            const startPosition = Position.create(start.line - 1, start.character - 1);
            const endPosition = Position.create(end.line - 1, end.character - 1);
            const range = Range.create(startPosition, endPosition);
            editor.revealRange(range);
            editor.selection = range;
        };
        const activeEditorWidget = this.editorManager.currentEditor;