How to use the vscode.Range function in vscode

To help you get started, we’ve selected a few vscode 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 microsoft / vscode-cpptools / Extension / src / LanguageServer / colorization.ts View on Github external
private textToRange(text: string, startPosition: vscode.Position): vscode.Range {
        let parts: string[] = text.split("\n");
        let addedLines: number = parts.length - 1;
        let newStartLine: number = startPosition.line;
        let newStartCharacter: number = startPosition.character;
        let newEndLine: number = newStartLine + addedLines;
        let newEndCharacter: number = parts[parts.length - 1].length;
        if (newStartLine === newEndLine) {
            newEndCharacter += newStartCharacter;
        }
        return new vscode.Range(newStartLine, newStartCharacter, newEndLine, newEndCharacter);
    }
github predragnikolic / php-class-helper / src / Helper.ts View on Github external
scrollIntoView(position: Position) {
        let range = new Range(position, position);
        this.editor.revealRange(range, TextEditorRevealType.InCenter);
    }
}
github schneiderpat / aspnet-helper / aspnet-helper / src / provider / completionItemProvider.ts View on Github external
public provideCompletionItems(document: vscode.TextDocument,
                                    position: vscode.Position,
                                    token: vscode.CancellationToken): Thenable {

        let start = new vscode.Position(position.line, 0);
        let range = new vscode.Range(start, position);
        let text = document.getText(range);

        let items = this._parser.getParsingResults(text, document);

        return Promise.resolve(items);

    }
github James-Yu / LaTeX-Workshop / src / providers / preview / mathpreview.ts View on Github external
private findHoverOnEnv(document: vscode.TextDocument | TextDocumentLike, envname: string, startPos: vscode.Position): TexMathEnv | undefined {
        const pattern = new RegExp('\\\\end\\{' + utils.escapeRegExp(envname) + '\\}')
        const startPos1 = new vscode.Position(startPos.line, startPos.character + envname.length + '\\begin{}'.length)
        const endPos = this.findEndPair(document, pattern, startPos1)
        if ( endPos ) {
            const range = new vscode.Range(startPos, endPos)
            return {texString: document.getText(range), range, envname}
        }
        return undefined
    }
github jan-dolejsi / vscode-pddl / client / src / debugger / HappeningsExecutor.ts View on Github external
createRange(happening: Happening): vscode.Range {
        let line = happening.lineIndex || 0;
        return new vscode.Range(line, 0, line, 100);
    }
}

vscode

## ⚠️ Deprecated, use @types/vscode and vscode-test instead ⚠️

MIT
Latest version published 4 years ago

Package Health Score

47 / 100
Full package analysis