MCPcopy Index your code
hub / github.com/nodejs/node / getLinesBetweenPositions

Function getLinesBetweenPositions

test/fixtures/snapshot/typescript.js:10372–10382  ·  view source on GitHub ↗

@internal

(sourceFile, pos1, pos2)

Source from the content-addressed store, hash-verified

10370 ts.computeLineOfPosition = computeLineOfPosition;
10371 /** @internal */
10372 function getLinesBetweenPositions(sourceFile, pos1, pos2) {
10373 if (pos1 === pos2)
10374 return 0;
10375 var lineStarts = getLineStarts(sourceFile);
10376 var lower = Math.min(pos1, pos2);
10377 var isNegative = lower === pos2;
10378 var upper = isNegative ? pos1 : pos2;
10379 var lowerLine = computeLineOfPosition(lineStarts, lower);
10380 var upperLine = computeLineOfPosition(lineStarts, upper, lowerLine);
10381 return isNegative ? lowerLine - upperLine : upperLine - lowerLine;
10382 }
10383 ts.getLinesBetweenPositions = getLinesBetweenPositions;
10384 function getLineAndCharacterOfPosition(sourceFile, position) {
10385 return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position);

Callers

nothing calls this directly

Calls 3

getLineStartsFunction · 0.85
computeLineOfPositionFunction · 0.85
minMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…