Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/core/tools/ApplyDiffTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ export class ApplyDiffTool extends BaseTool<"apply_diff"> {
}

if (isPreventFocusDisruptionEnabled) {
// Show progress indicator in UI while preparing the file
const partialMessage = JSON.stringify(sharedMessageProps)
await task.ask("tool", partialMessage, true).catch(() => {})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it okay to just swallow the error here?


// Direct file write without diff view
const completeMessage = JSON.stringify({
...sharedMessageProps,
Expand Down
6 changes: 6 additions & 0 deletions src/core/tools/EditFileTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ export class EditFileTool extends BaseTool<"edit_file"> {
diffStats,
} satisfies ClineSayTool)

// Show progress indicator in UI while preparing the file when background editing is enabled
if (isPreventFocusDisruptionEnabled) {
const partialMessage = JSON.stringify(sharedMessageProps)
await task.ask("tool", partialMessage, true).catch(() => {})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it okay to swallow errors?

}

// Show diff view if focus disruption prevention is disabled
if (!isPreventFocusDisruptionEnabled) {
await task.diffViewProvider.open(relPath)
Expand Down
4 changes: 4 additions & 0 deletions src/core/tools/MultiApplyDiffTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,10 @@ ${errorDetails ? `\nTechnical details:\n${errorDetails}\n` : ""}
await cline.diffViewProvider.update(originalContent!, true)
cline.diffViewProvider.scrollToFirstDiff()
} else {
// Show progress indicator in UI while preparing the file
const partialMessage = JSON.stringify(sharedMessageProps)
await cline.ask("tool", partialMessage, true).catch(() => {})

// For direct save, we still need to set originalContent
cline.diffViewProvider.originalContent = await fs.readFile(absolutePath, "utf-8")
}
Expand Down
6 changes: 6 additions & 0 deletions src/core/tools/SearchAndReplaceTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ export class SearchAndReplaceTool extends BaseTool<"search_and_replace"> {
diffStats,
} satisfies ClineSayTool)

// Show progress indicator in UI while preparing the file when background editing is enabled
if (isPreventFocusDisruptionEnabled) {
const partialMessage = JSON.stringify(sharedMessageProps)
await task.ask("tool", partialMessage, true).catch(() => {})
}

// Show diff view if focus disruption prevention is disabled
if (!isPreventFocusDisruptionEnabled) {
await task.diffViewProvider.open(relPath)
Expand Down
6 changes: 6 additions & 0 deletions src/core/tools/SearchReplaceTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ export class SearchReplaceTool extends BaseTool<"search_replace"> {
diffStats,
} satisfies ClineSayTool)

// Show progress indicator in UI while preparing the file when background editing is enabled
if (isPreventFocusDisruptionEnabled) {
const partialMessage = JSON.stringify(sharedMessageProps)
await task.ask("tool", partialMessage, true).catch(() => {})
}

// Show diff view if focus disruption prevention is disabled
if (!isPreventFocusDisruptionEnabled) {
await task.diffViewProvider.open(relPath)
Expand Down
4 changes: 4 additions & 0 deletions src/core/tools/WriteToFileTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ export class WriteToFileTool extends BaseTool<"write_to_file"> {
)

if (isPreventFocusDisruptionEnabled) {
// Show progress indicator in UI while preparing the file
const partialMessage = JSON.stringify(sharedMessageProps)
await task.ask("tool", partialMessage, true).catch(() => {})

task.diffViewProvider.editType = fileExists ? "modify" : "create"
if (fileExists) {
const absolutePath = path.resolve(task.cwd, relPath)
Expand Down
Loading