From 4356cffb0d2f3c89065ae860324d12388b8dac8d Mon Sep 17 00:00:00 2001 From: Daniel Riccio Date: Tue, 7 Jan 2025 18:57:40 -0500 Subject: [PATCH] Refactor applyDiff method to return a Promise and add logging for diff results --- src/core/Cline.ts | 3 ++- src/core/diff/types.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 840caff..8e25679 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -1277,7 +1277,7 @@ export class Cline { const originalContent = await fs.readFile(absolutePath, "utf-8") // Apply the diff to the original content - const diffResult = this.diffStrategy?.applyDiff( + const diffResult = await this.diffStrategy?.applyDiff( originalContent, diffContent, parseInt(block.params.start_line ?? ''), @@ -1286,6 +1286,7 @@ export class Cline { success: false, error: "No diff strategy available" } + console.log("diffResult", diffResult) if (!diffResult.success) { this.consecutiveMistakeCount++ const currentCount = (this.consecutiveMistakeCountForApplyDiff.get(relPath) || 0) + 1 diff --git a/src/core/diff/types.ts b/src/core/diff/types.ts index 3957a1f..7666d0f 100644 --- a/src/core/diff/types.ts +++ b/src/core/diff/types.ts @@ -28,5 +28,5 @@ export interface DiffStrategy { * @param endLine Optional line number where the search block ends. If not provided, searches the entire file. * @returns A DiffResult object containing either the successful result or error details */ - applyDiff(originalContent: string, diffContent: string, startLine?: number, endLine?: number): DiffResult -} + applyDiff(originalContent: string, diffContent: string, startLine?: number, endLine?: number): Promise +} \ No newline at end of file