fix: restore diff count indicators after apply_diff operations

- Add final tool messages with diffStats after successful single file operations
- Add final tool messages with diffStats after successful batch operations
- Ensures UI updates with change counters (+added -removed) after edits complete
- Fixes issue where diff stats were shown during approval but disappeared after completion

Fixes #9305
This commit is contained in:
Roo Code 2025-11-17 15:31:32 +00:00
parent 3e0bd0ea55
commit a728a233f2

View file

@ -664,6 +664,15 @@ ${errorDetails ? `\nTechnical details:\n${errorDetails}\n` : ""}
// Call saveChanges to update the DiffViewProvider properties
await cline.diffViewProvider.saveChanges(diagnosticsEnabled, writeDelayMs)
}
// Send final tool message with diff stats to update the UI
const finalMessage = JSON.stringify({
...sharedMessageProps,
diff: diffContents,
content: unifiedPatch,
diffStats: computeDiffStats(unifiedPatch) || undefined,
} satisfies ClineSayTool)
await cline.ask("tool", finalMessage, false).catch(() => {})
} else {
// Batch operations - already approved above
if (isPreventFocusDisruptionEnabled) {
@ -687,6 +696,18 @@ ${errorDetails ? `\nTechnical details:\n${errorDetails}\n` : ""}
// Call saveChanges to update the DiffViewProvider properties
await cline.diffViewProvider.saveChanges(diagnosticsEnabled, writeDelayMs)
}
// Send final tool message with diff stats for batch operations
const diffContents = diffItems.map((item) => item.content).join("\n\n")
const unifiedPatchRaw = formatResponse.createPrettyPatch(relPath, beforeContent!, originalContent!)
const unifiedPatch = sanitizeUnifiedDiff(unifiedPatchRaw)
const finalMessage = JSON.stringify({
...sharedMessageProps,
diff: diffContents,
content: unifiedPatch,
diffStats: computeDiffStats(unifiedPatch) || undefined,
} satisfies ClineSayTool)
await cline.ask("tool", finalMessage, false).catch(() => {})
}
// Track file edit operation