(chosen: ReadonlySet<number>)
| 7552 | // the fit test below trims the weakest cluster and re-assembles rather |
| 7553 | // than skipping the file (CG-26). |
| 7554 | const assembleSection = (chosen: ReadonlySet<number>) => { |
| 7555 | const parts: SectionPart[] = []; |
| 7556 | const symbols: string[] = []; |
| 7557 | const covered: ExploreLineRange[] = []; |
| 7558 | for (let i = 0; i < clusters.length; i++) { |
| 7559 | if (!chosen.has(i)) continue; |
| 7560 | const cluster = clusters[i]!; |
| 7561 | const section = renderedClusters.get(i)!; |
| 7562 | parts.push(...section.parts); |
| 7563 | covered.push(...section.covered); |
| 7564 | symbols.push(...cluster.symbols); |
| 7565 | } |
| 7566 | // Every member across ALL clusters (chosen or not) is a candidate for |
| 7567 | // the header bias — a dropped cluster's symbols used to vanish from |
| 7568 | // the header entirely (#1711). |
| 7569 | const memberRefs: ElidedSymbolRef[] = []; |
| 7570 | const seenMember = new Set<string>(); |
| 7571 | for (const c of clusters) { |
| 7572 | for (const m of c.members) { |
| 7573 | if (seenMember.has(m.name)) continue; |
| 7574 | seenMember.add(m.name); |
| 7575 | memberRefs.push({ name: m.name, kind: m.kind, startLine: m.start }); |
| 7576 | } |
| 7577 | } |
| 7578 | const ranges = parts.map((p) => p.range); |
| 7579 | const text = joinPartsWithNamedGaps( |
| 7580 | filePath, parts, fileIndexNodes, Math.max(0, namedGapBudget - sectionText(parts).length), |
| 7581 | ); |
| 7582 | // Header bias prefers RELEVANT elisions (cluster members the trim cut) |
| 7583 | // over incidental index filler — otherwise locale-sorted `calls0`… |
| 7584 | // crowds out the answer methods (#1711). |
| 7585 | const elided = symbolsNotInRanges(memberRefs, ranges); |
| 7586 | return { text, symbols, ranges, covered, elided }; |
| 7587 | }; |
| 7588 | let assembled = assembleSection(chosenIndices); |
| 7589 | |
| 7590 | // A chosen cluster is a COMPLETE method-range — we never cut through a body, |
nothing calls this directly
no test coverage detected