MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / positionToLine

Function positionToLine

src/codegraph/extractor.ts:216–225  ·  view source on GitHub ↗
(pos: number)

Source from the content-addressed store, hash-verified

214 lineOffsets.push(lineOffsets[i]! + lines[i]!.length + 1);
215 }
216 const positionToLine = (pos: number): { line: number; col: number } => {
217 // Binary search
218 let lo = 0, hi = lineOffsets.length - 1;
219 while (lo < hi) {
220 const mid = (lo + hi + 1) >>> 1;
221 if (lineOffsets[mid]! <= pos) lo = mid;
222 else hi = mid - 1;
223 }
224 return { line: lo + 1, col: pos - lineOffsets[lo]! };
225 };
226
227 const symbols: ExtractedSymbol[] = [];
228 for (const { pattern, kind } of patterns) {

Callers 1

extractWithRegexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected