From 907ad483710c1d5271e7d16cfa7f36a53a774fa9 Mon Sep 17 00:00:00 2001 From: vivek-kothandapani Date: Tue, 28 Jan 2025 17:57:51 -0500 Subject: [PATCH] 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,