Skip to content

Commit 3b65023

Browse files
authored
feat(diff): improve progress indicator for apply_diff tool (#2758)
Add animated dots to progress indicator based on content length Optimize when progress updates are shown (every 10 characters) Move searchBlockCount calculation inside conditional blocks Skip unnecessary ask operations when toolProgressStatus is empty
1 parent c228e63 commit 3b65023

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/core/diff/strategies/multi-search-replace.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,12 +574,13 @@ Only use a single line of '=======' between search and replacement content, beca
574574
const diffContent = toolUse.params.diff
575575
if (diffContent) {
576576
const icon = "diff-multiple"
577-
const searchBlockCount = (diffContent.match(/SEARCH/g) || []).length
578577
if (toolUse.partial) {
579-
if (diffContent.length < 1000 || (diffContent.length / 50) % 10 === 0) {
578+
if (Math.floor(diffContent.length / 10) % 10 === 0) {
579+
const searchBlockCount = (diffContent.match(/SEARCH/g) || []).length
580580
return { icon, text: `${searchBlockCount}` }
581581
}
582582
} else if (result) {
583+
const searchBlockCount = (diffContent.match(/SEARCH/g) || []).length
583584
if (result.failParts?.length) {
584585
return {
585586
icon,

src/core/tools/applyDiffTool.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ export async function applyDiffTool(
4242
toolProgressStatus = cline.diffStrategy.getProgressStatus(block)
4343
}
4444

45+
if (toolProgressStatus && Object.keys(toolProgressStatus).length === 0) {
46+
return
47+
}
48+
4549
const partialMessage = JSON.stringify(sharedMessageProps)
4650
await cline.ask("tool", partialMessage, block.partial, toolProgressStatus).catch(() => {})
4751
return

0 commit comments

Comments
 (0)