MCPcopy Create free account
hub / github.com/angular/angular / tsTextSpanToLspRange

Function tsTextSpanToLspRange

vscode-ng-language-service/server/src/utils.ts:78–83  ·  view source on GitHub ↗
(scriptInfo: ts.server.ScriptInfo, textSpan: ts.TextSpan)

Source from the content-addressed store, hash-verified

76 * @param textSpan
77 */
78export function tsTextSpanToLspRange(scriptInfo: ts.server.ScriptInfo, textSpan: ts.TextSpan) {
79 const start = scriptInfo.positionToLineOffset(textSpan.start);
80 const end = scriptInfo.positionToLineOffset(textSpan.start + textSpan.length);
81 // ScriptInfo (TS) is 1-based, LSP is 0-based.
82 return lsp.Range.create(start.line - 1, start.offset - 1, end.line - 1, end.offset - 1);
83}
84
85/**
86 * Convert lsp.Position to the absolute offset in the file. LSP keeps track of

Callers 15

convertLinkTagsFunction · 0.90
onGetTcbFunction · 0.90
onHoverFunction · 0.90
filterNavigationItemFunction · 0.90
convertTemplateSymbolFunction · 0.90
createTextEditFunction · 0.90
onDefinitionFunction · 0.90
onReferencesFunction · 0.90

Calls 1

createMethod · 0.65

Tested by

no test coverage detected