From 907ad483710c1d5271e7d16cfa7f36a53a774fa9 Mon Sep 17 00:00:00 2001 From: vivek-kothandapani Date: Tue, 28 Jan 2025 17:57:51 -0500 Subject: [PATCH 1/3] fix: Diff Edit Failed --- src/core/Cline.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index c1c5bf186a..7a118d10a8 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -1602,6 +1602,13 @@ export class Cline { diff = fixModelHtmlEscaping(diff) diff = removeInvalidChars(diff) } + + // open the editor if not done already. This is to fix diff error when model provides correct search-replace text but Cline throws error + // because file is not open. + if (!this.diffViewProvider.isEditing) { + await this.diffViewProvider.open(relPath) + } + try { newContent = await constructNewFileContent( diff, From c587c6f7ac6792bf2e2a2bf44e2c8c8fe673b654 Mon Sep 17 00:00:00 2001 From: vivek-kothandapani Date: Tue, 28 Jan 2025 18:14:56 -0500 Subject: [PATCH 2/3] format fix --- src/core/Cline.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 7a118d10a8..ec0a9b1bce 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -1604,7 +1604,7 @@ export class Cline { } // open the editor if not done already. This is to fix diff error when model provides correct search-replace text but Cline throws error - // because file is not open. + // because file is not open. if (!this.diffViewProvider.isEditing) { await this.diffViewProvider.open(relPath) } From 3ad7b219a1161d2362c95fd17a97a9bbceb50ab0 Mon Sep 17 00:00:00 2001 From: vivek-kothandapani Date: Wed, 29 Jan 2025 09:55:09 -0500 Subject: [PATCH 3/3] changie updates --- .changes/unreleased/Fixed-20250129-095107.yaml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changes/unreleased/Fixed-20250129-095107.yaml diff --git a/.changes/unreleased/Fixed-20250129-095107.yaml b/.changes/unreleased/Fixed-20250129-095107.yaml new file mode 100644 index 0000000000..9404c5fe22 --- /dev/null +++ b/.changes/unreleased/Fixed-20250129-095107.yaml @@ -0,0 +1,3 @@ +kind: Fixed +body: Fix for the "Diff Edit Failed" / "replace_in_file" defects - #1010 #1511 #953 +time: 2025-01-29T09:51:07.5008655-05:00