mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Improve failed diff edit response
This commit is contained in:
parent
2c0340eaaa
commit
b2cae6c2fb
2 changed files with 8 additions and 2 deletions
|
|
@ -1140,7 +1140,13 @@ export class Cline {
|
|||
} catch (error) {
|
||||
await this.say("diff_error", relPath)
|
||||
pushToolResult(
|
||||
formatResponse.toolError(`Error writing file: ${(error as Error)?.message}`),
|
||||
formatResponse.toolError(
|
||||
`${(error as Error)?.message}\n\n` +
|
||||
`This is likely due to character mismatches between the SEARCH block and the actual file.\n\n` +
|
||||
`The file was reverted to its original state:\n\n` +
|
||||
`<file_content path="${relPath.toPosix()}">\n${this.diffViewProvider.originalContent}\n</file_content>\n\n` +
|
||||
`Try again with a more precise SEARCH block.\n(If you keep running into this error, you may use the write_to_file tool as a workaround.)`,
|
||||
),
|
||||
)
|
||||
await this.diffViewProvider.revertChanges()
|
||||
await this.diffViewProvider.reset()
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ export async function constructNewFileContent(
|
|||
;[searchMatchIndex, searchEndIndex] = blockMatch
|
||||
} else {
|
||||
throw new Error(
|
||||
`The SEARCH block:\n${currentSearchContent.trimEnd()}\n...does not match anything in the file.\nThis is likely due to differences in whitespace or line endings between the SEARCH block and the actual file. Try again with a more precise SEARCH block.\n(If you keep running into this error, you may use the write_to_file tool as a workaround.)`,
|
||||
`The SEARCH block:\n${currentSearchContent.trimEnd()}\n...does not match anything in the file.`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue