Skip to content

Commit a728a23

Browse files
committed
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
1 parent 3e0bd0e commit a728a23

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/core/tools/MultiApplyDiffTool.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,15 @@ ${errorDetails ? `\nTechnical details:\n${errorDetails}\n` : ""}
664664
// Call saveChanges to update the DiffViewProvider properties
665665
await cline.diffViewProvider.saveChanges(diagnosticsEnabled, writeDelayMs)
666666
}
667+
668+
// Send final tool message with diff stats to update the UI
669+
const finalMessage = JSON.stringify({
670+
...sharedMessageProps,
671+
diff: diffContents,
672+
content: unifiedPatch,
673+
diffStats: computeDiffStats(unifiedPatch) || undefined,
674+
} satisfies ClineSayTool)
675+
await cline.ask("tool", finalMessage, false).catch(() => {})
667676
} else {
668677
// Batch operations - already approved above
669678
if (isPreventFocusDisruptionEnabled) {
@@ -687,6 +696,18 @@ ${errorDetails ? `\nTechnical details:\n${errorDetails}\n` : ""}
687696
// Call saveChanges to update the DiffViewProvider properties
688697
await cline.diffViewProvider.saveChanges(diagnosticsEnabled, writeDelayMs)
689698
}
699+
700+
// Send final tool message with diff stats for batch operations
701+
const diffContents = diffItems.map((item) => item.content).join("\n\n")
702+
const unifiedPatchRaw = formatResponse.createPrettyPatch(relPath, beforeContent!, originalContent!)
703+
const unifiedPatch = sanitizeUnifiedDiff(unifiedPatchRaw)
704+
const finalMessage = JSON.stringify({
705+
...sharedMessageProps,
706+
diff: diffContents,
707+
content: unifiedPatch,
708+
diffStats: computeDiffStats(unifiedPatch) || undefined,
709+
} satisfies ClineSayTool)
710+
await cline.ask("tool", finalMessage, false).catch(() => {})
690711
}
691712

692713
// Track file edit operation

0 commit comments

Comments
 (0)