(chosen: ReadonlySet<number>)
| 7608 | // the fit test below trims the weakest cluster and re-assembles rather |
| 7609 | // than skipping the file (CG-26). |
| 7610 | const assembleSection = (chosen: ReadonlySet<number>) => { |
| 7611 | const parts: SectionPart[] = []; |
| 7612 | const symbols: string[] = []; |
| 7613 | const covered: ExploreLineRange[] = []; |
| 7614 | for (let i = 0; i < clusters.length; i++) { |
| 7615 | if (!chosen.has(i)) continue; |
| 7616 | const cluster = clusters[i]!; |
| 7617 | const section = renderedClusters.get(i)!; |
| 7618 | parts.push(...section.parts); |
| 7619 | covered.push(...section.covered); |
| 7620 | symbols.push(...cluster.symbols); |
| 7621 | } |
| 7622 | // Every member across ALL clusters (chosen or not) is a candidate for |
| 7623 | // the header bias — a dropped cluster's symbols used to vanish from |
| 7624 | // the header entirely (#1711). |
| 7625 | const memberRefs: ElidedSymbolRef[] = []; |
| 7626 | const seenMember = new Set<string>(); |
| 7627 | for (const c of clusters) { |
| 7628 | for (const m of c.members) { |
| 7629 | if (seenMember.has(m.name)) continue; |
| 7630 | seenMember.add(m.name); |
| 7631 | memberRefs.push({ name: m.name, kind: m.kind, startLine: m.start }); |
| 7632 | } |
| 7633 | } |
| 7634 | const ranges = parts.map((p) => p.range); |
| 7635 | const text = joinPartsWithNamedGaps( |
| 7636 | filePath, parts, fileIndexNodes, Math.max(0, namedGapBudget - sectionText(parts).length), |
| 7637 | ); |
| 7638 | // Header bias prefers RELEVANT elisions (cluster members the trim cut) |
| 7639 | // over incidental index filler — otherwise locale-sorted `calls0`… |
| 7640 | // crowds out the answer methods (#1711). |
| 7641 | const elided = symbolsNotInRanges(memberRefs, ranges); |
| 7642 | return { text, symbols, ranges, covered, elided }; |
| 7643 | }; |
| 7644 | let assembled = assembleSection(chosenIndices); |
| 7645 | |
| 7646 | // A chosen cluster is a COMPLETE method-range — we never cut through a body, |
nothing calls this directly
no test coverage detected