How to use the vscode-languageserver-types.Position.create function in vscode-languageserver-types

To help you get started, we’ve selected a few vscode-languageserver-types 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 neoclide / coc.nvim / src / cursors / index.ts View on Github external
function adjustPosition(position: Position, delta: Position): Position {
  let { line, character } = delta
  return Position.create(position.line + line, line == 0 ? position.character + character : character)
}
github vuejs / vetur / server / src / modes / style / stylus / symbols-finder.ts View on Github external
function _selectorSymbol(node: StylusNode, text: string[]): SymbolInformation {
  const firstSegment = node.segments[0];
  const name = firstSegment.string
    ? node.segments.map(s => s.string).join('')
    : firstSegment.nodes!.map(s => s.name).join('');
  const lineno = Number(firstSegment.lineno) - 1;
  const column = node.column - 1;

  const posStart = Position.create(lineno, column);
  const posEnd = Position.create(lineno, column + name.length);
  const range = Range.create(posStart, posEnd);

  return SymbolInformation.create(name, SymbolKind.Class, range);
}
github microsoft / vscode / extensions / css / server / src / pathCompletion.ts View on Github external
function getReplaceRange(valueRange: Range, valueAfterLastSlash: string) {
	const start = Position.create(valueRange.end.line, valueRange.end.character - valueAfterLastSlash.length);
	const end = Position.create(valueRange.end.line, valueRange.end.character);
	return Range.create(start, end);
}
function getRangeWithoutQuotes(range: Range) {
github microsoft / vscode / extensions / css / server / src / pathCompletion.ts View on Github external
function getFullReplaceRange(valueRange: Range) {
	const start = Position.create(valueRange.end.line, valueRange.start.character);
	const end = Position.create(valueRange.end.line, valueRange.end.character);
	return Range.create(start, end);
}
function getReplaceRange(valueRange: Range, valueAfterLastSlash: string) {
github vuejs / vetur / server / src / modes / style / stylus / symbols-finder.ts View on Github external
function _selectorCallSymbol(node: StylusNode, text: string[]): SymbolInformation {
  const lineno = Number(node.lineno) - 1;
  const name = prepareName(text[lineno]);
  const column = Math.max(text[lineno].indexOf(name), 0);

  const posStart = Position.create(lineno, column);
  const posEnd = Position.create(lineno, column + name.length);

  return SymbolInformation.create(name, SymbolKind.Class, Range.create(posStart, posEnd));
}
github microsoft / vscode-json-languageservice / src / services / jsonFormatter.ts View on Github external
function getEOL(document: TextDocument): string {
	let text = document.getText();
	if (document.lineCount > 1) {
		let to = document.offsetAt(Position.create(1, 0));
		let from = to;
		while (from > 0 && isEOL(text, from - 1)) {
			from--;
		}
		return text.substr(from, to - from);
	}
	return '\n';
}
github vuejs / vetur / server / src / modes / style / stylus / symbols-finder.ts View on Github external
function _functionSymbol(node: StylusNode, text: string[]): SymbolInformation {
  const name = node.name;
  const lineno = Number(node.val!.lineno) - 1;
  const column = Math.max(text[lineno].indexOf(name), 0);

  const posStart = Position.create(lineno, column);
  const posEnd = Position.create(lineno, column + name.length);
  const range = Range.create(posStart, posEnd);

  return SymbolInformation.create(name, SymbolKind.Function, range);
}
github microsoft / BotFramework-Composer / Composer / packages / tools / language-servers / lg / server / src / lg-server.ts View on Github external
lgDiags.forEach(diag => {
      let diagnostic: Diagnostic = {
        severity: this.convertSeverity(diag.Severity),
        range: {
          start: Position.create(diag.Range.Start.Line, diag.Range.Start.Character),
          end: Position.create(diag.Range.End.Line, diag.Range.End.Character),
        },
        message: diag.Message,
        source: document.uri,
      };
      diagnostics.push(diagnostic);
    });
github eclipse-theia / theia / packages / plugin-ext / src / common / known-commands.ts View on Github external
function fromPositionToP(p: theia.Position): P {
        return P.create(p.line, p.character);
    }