MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / renderedSpanCost

Method renderedSpanCost

src/mcp/tools.ts:6207–6215  ·  view source on GitHub ↗
(start: number, end: number)

Source from the content-addressed store, hash-verified

6205 let lineCostPrefix: number[] | null = null;
6206 /** Rendered chars of lines `start..end` (line numbers included), in O(1). */
6207 const renderedSpanCost = (start: number, end: number): number => {
6208 if (!lineCostPrefix) {
6209 lineCostPrefix = [0];
6210 for (let ln = 1; ln <= fileLines.length; ln++) lineCostPrefix.push(lineCostPrefix[ln - 1]! + lineCost(ln));
6211 }
6212 const s = Math.max(1, start);
6213 const e = Math.min(fileLines.length, end);
6214 return e < s ? 0 : Math.max(0, lineCostPrefix[e]! - lineCostPrefix[s - 1]! - 1);
6215 };
6216 /**
6217 * Longest prefix of `r` that fits `room`. `minLines` is the never-empty
6218 * floor — it may overrun `room`, so it is only ever asked for when nothing

Callers

nothing calls this directly

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected