(c: { start: number; end: number; hasSpine?: boolean; spineCallLine?: number })
| 3626 | const OVERSIZE_SPINE_LINES = 200; |
| 3627 | const SPINE_WINDOW = 28; // lines each side of the next-hop call site |
| 3628 | const buildSection = (c: { start: number; end: number; hasSpine?: boolean; spineCallLine?: number }): string => { |
| 3629 | if (c.hasSpine && c.spineCallLine && (c.end - c.start + 1) > OVERSIZE_SPINE_LINES) { |
| 3630 | const call = c.spineCallLine; |
| 3631 | const winStart = Math.max(c.start, call - SPINE_WINDOW); |
| 3632 | const winEnd = Math.min(c.end, call + SPINE_WINDOW); |
| 3633 | const parts: string[] = []; |
| 3634 | // Signature head, only when it sits clearly above the window (else the |
| 3635 | // window already covers the method opening). |
| 3636 | const headEnd = Math.min(c.start + 4, winStart - 2); |
| 3637 | if (headEnd >= c.start) { |
| 3638 | const head = fileLines.slice(c.start - 1, headEnd).join('\n'); |
| 3639 | parts.push(withLineNumbers ? numberSourceLines(head, c.start) : head); |
| 3640 | } |
| 3641 | const win = fileLines.slice(winStart - 1, winEnd).join('\n'); |
| 3642 | parts.push(withLineNumbers ? numberSourceLines(win, winStart) : win); |
| 3643 | return parts.join(GAP_MARKER); |
| 3644 | } |
| 3645 | const startIdx = Math.max(0, c.start - 1 - contextPadding); |
| 3646 | const endIdx = Math.min(fileLines.length, c.end + contextPadding); |
| 3647 | const slice = fileLines.slice(startIdx, endIdx).join('\n'); |
| 3648 | // startIdx is 0-based, so the slice's first line is line startIdx + 1. |
| 3649 | return withLineNumbers ? numberSourceLines(slice, startIdx + 1) : slice; |
| 3650 | }; |
| 3651 | |
| 3652 | // Rank clusters for inclusion under the per-file cap. Entry-point |
| 3653 | // clusters come first: a cluster containing a query entry point |
nothing calls this directly
no test coverage detected