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

Method dedupeSpans

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

Source from the content-addressed store, hash-verified

6040 * what we claim to have sent and what we sent the same thing.
6041 */
6042 const dedupeSpans = (
6043 parts: ReadonlyArray<{ range: ExploreLineRange; text: string }>,
6044 ): { parts: Array<{ range: ExploreLineRange; text: string }>; covered: ExploreLineRange[] } => {
6045 if (served.length === 0) return { parts: [...parts], covered: [] };
6046 const kept: Array<{ range: ExploreLineRange; text: string }> = [];
6047 const covered: ExploreLineRange[] = [];
6048 for (const part of parts) {
6049 const split = dedupeRange(part.range, served);
6050 if (split.covered.length === 0) {
6051 kept.push(part);
6052 continue;
6053 }
6054 covered.push(...split.covered);
6055 for (const r of split.emit) kept.push({ range: r, text: renderSpan(r) });
6056 }
6057 return { parts: kept, covered: mergeRanges(covered) };
6058 };
6059 const coveredChars = (spans: ReadonlyArray<ExploreLineRange>): number =>
6060 spans.reduce((sum, r) => sum + fileLines.slice(r.start - 1, r.end).join('\n').length, 0);
6061 /**

Callers

nothing calls this directly

Calls 3

dedupeRangeFunction · 0.90
mergeRangesFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected