Merge pull request #1524 from vivek-kothandapani/diff-edit-failed

fix: Diff Edit Failed
This commit is contained in:
akfoster 2025-01-29 11:00:54 -08:00 committed by GitHub
commit 754a075ac0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View file

@ -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

View file

@ -1595,6 +1595,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,