MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / position

Function position

graph-ui/src/browser-ai/explanation-context.ts:54–61  ·  view source on GitHub ↗
(offset: number)

Source from the content-addressed store, hash-verified

52 const starts = [0];
53 for (let index = 0; index < text.length; index++) if (text.charCodeAt(index) === 10) starts.push(index + 1);
54 const position = (offset: number) => {
55 let low = 0, high = starts.length;
56 while (low + 1 < high) {
57 const middle = (low + high) >>> 1;
58 if (starts[middle] <= offset) low = middle; else high = middle;
59 }
60 return { line: source.startLine + low, column: offset - starts[low] + (low === 0 ? source.startColumn : 1) };
61 };
62 const make = (start: number, end: number, index: number): ExplanationEvidence => {
63 const content = prefix(text.slice(start, end), end - start);
64 // slice(start, end) may itself end halfway through a pair; inspect the

Callers 1

makeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected