mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Refactor applyDiff method to return a Promise and add logging for diff results
This commit is contained in:
@@ -1277,7 +1277,7 @@ export class Cline {
|
|||||||
const originalContent = await fs.readFile(absolutePath, "utf-8")
|
const originalContent = await fs.readFile(absolutePath, "utf-8")
|
||||||
|
|
||||||
// Apply the diff to the original content
|
// Apply the diff to the original content
|
||||||
const diffResult = this.diffStrategy?.applyDiff(
|
const diffResult = await this.diffStrategy?.applyDiff(
|
||||||
originalContent,
|
originalContent,
|
||||||
diffContent,
|
diffContent,
|
||||||
parseInt(block.params.start_line ?? ''),
|
parseInt(block.params.start_line ?? ''),
|
||||||
@@ -1286,6 +1286,7 @@ export class Cline {
|
|||||||
success: false,
|
success: false,
|
||||||
error: "No diff strategy available"
|
error: "No diff strategy available"
|
||||||
}
|
}
|
||||||
|
console.log("diffResult", diffResult)
|
||||||
if (!diffResult.success) {
|
if (!diffResult.success) {
|
||||||
this.consecutiveMistakeCount++
|
this.consecutiveMistakeCount++
|
||||||
const currentCount = (this.consecutiveMistakeCountForApplyDiff.get(relPath) || 0) + 1
|
const currentCount = (this.consecutiveMistakeCountForApplyDiff.get(relPath) || 0) + 1
|
||||||
|
|||||||
@@ -28,5 +28,5 @@ export interface DiffStrategy {
|
|||||||
* @param endLine Optional line number where the search block ends. If not provided, searches the entire file.
|
* @param endLine Optional line number where the search block ends. If not provided, searches the entire file.
|
||||||
* @returns A DiffResult object containing either the successful result or error details
|
* @returns A DiffResult object containing either the successful result or error details
|
||||||
*/
|
*/
|
||||||
applyDiff(originalContent: string, diffContent: string, startLine?: number, endLine?: number): DiffResult
|
applyDiff(originalContent: string, diffContent: string, startLine?: number, endLine?: number): Promise<DiffResult>
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user