MCPcopy
hub / github.com/continuedev/continue / groupDiffLines

Function groupDiffLines

core/nextEdit/diff/diff.ts:287–316  ·  view source on GitHub ↗
(
  diffLines: DiffLine[],
  offset: number = 0,
  maxGroupSize?: number,
)

Source from the content-addressed store, hash-verified

285 * @returns Array of DiffGroup objects representing the changes
286 */
287export function groupDiffLines(
288 diffLines: DiffLine[],
289 offset: number = 0,
290 maxGroupSize?: number,
291): DiffGroup[] {
292 const groups: DiffGroup[] = [];
293 const changedAreas = findChangedAreas(diffLines);
294
295 for (const area of changedAreas) {
296 if (maxGroupSize === undefined) {
297 // Mode 1: Flexible group size.
298 groups.push(
299 processFlexibleSizeGroup(diffLines, area.start, area.end, offset),
300 );
301 } else {
302 // Mode 2: Limited group size.
303 groups.push(
304 processLimitedSizeGroup(
305 diffLines,
306 area.start,
307 area.end,
308 maxGroupSize,
309 offset,
310 ),
311 );
312 }
313 }
314
315 return groups;
316}
317
318/**
319 * Find areas of change in the diff lines.

Callers 1

handleFullFileDiffFunction · 0.85

Calls 4

findChangedAreasFunction · 0.85
processFlexibleSizeGroupFunction · 0.85
processLimitedSizeGroupFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected