MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / findContext

Function findContext

sdk/src/tools/apply-patch.ts:329–347  ·  view source on GitHub ↗
(
  lines: string[],
  context: string[],
  start: number,
  eof: boolean,
)

Source from the content-addressed store, hash-verified

327}
328
329function findContext(
330 lines: string[],
331 context: string[],
332 start: number,
333 eof: boolean,
334): { newIndex: number; fuzz: number } {
335 if (eof) {
336 const endStart = Math.max(0, lines.length - context.length)
337 const endMatch = findContextCore(lines, context, endStart)
338 if (endMatch.newIndex !== -1) {
339 return endMatch
340 }
341
342 const fallback = findContextCore(lines, context, start)
343 return { newIndex: fallback.newIndex, fuzz: fallback.fuzz + 10000 }
344 }
345
346 return findContextCore(lines, context, start)
347}
348
349function parseUpdateDiff(
350 lines: string[],

Callers 1

parseUpdateDiffFunction · 0.85

Calls 1

findContextCoreFunction · 0.85

Tested by

no test coverage detected