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

Method dedupeSpans

src/mcp/tools.ts:6098–6114  ·  view source on GitHub ↗
(
        parts: ReadonlyArray<{ range: ExploreLineRange; text: string }>,
      )

Source from the content-addressed store, hash-verified

6096 * what we claim to have sent and what we sent the same thing.
6097 */
6098 const dedupeSpans = (
6099 parts: ReadonlyArray<{ range: ExploreLineRange; text: string }>,
6100 ): { parts: Array<{ range: ExploreLineRange; text: string }>; covered: ExploreLineRange[] } => {
6101 if (served.length === 0) return { parts: [...parts], covered: [] };
6102 const kept: Array<{ range: ExploreLineRange; text: string }> = [];
6103 const covered: ExploreLineRange[] = [];
6104 for (const part of parts) {
6105 const split = dedupeRange(part.range, served);
6106 if (split.covered.length === 0) {
6107 kept.push(part);
6108 continue;
6109 }
6110 covered.push(...split.covered);
6111 for (const r of split.emit) kept.push({ range: r, text: renderSpan(r) });
6112 }
6113 return { parts: kept, covered: mergeRanges(covered) };
6114 };
6115 const coveredChars = (spans: ReadonlyArray<ExploreLineRange>): number =>
6116 spans.reduce((sum, r) => sum + fileLines.slice(r.start - 1, r.end).join('\n').length, 0);
6117 /**

Callers

nothing calls this directly

Calls 3

dedupeRangeFunction · 0.90
mergeRangesFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected