Skip to content

Commit 754a075

Browse files
authored
Merge pull request RooCodeInc#1524 from vivek-kothandapani/diff-edit-failed
fix: Diff Edit Failed
2 parents 5037541 + 3ad7b21 commit 754a075

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Fixed
2+
body: Fix for the "Diff Edit Failed" / "replace_in_file" defects - #1010 #1511 #953
3+
time: 2025-01-29T09:51:07.5008655-05:00

src/core/Cline.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,13 @@ export class Cline {
15951595
diff = fixModelHtmlEscaping(diff)
15961596
diff = removeInvalidChars(diff)
15971597
}
1598+
1599+
// open the editor if not done already. This is to fix diff error when model provides correct search-replace text but Cline throws error
1600+
// because file is not open.
1601+
if (!this.diffViewProvider.isEditing) {
1602+
await this.diffViewProvider.open(relPath)
1603+
}
1604+
15981605
try {
15991606
newContent = await constructNewFileContent(
16001607
diff,

0 commit comments

Comments
 (0)