mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: add progress indicator for background editing in all file edit tools
When the preventFocusDisruption (Background Editing) experiment is enabled, file writing operations now display a progress indicator (spinner) in the chat UI before file operations begin. This addresses Issue #10504 where users would see no visual feedback while Roo was preparing and writing files in the background, causing confusion about whether the app had frozen. Files updated: - WriteToFileTool.ts - ApplyDiffTool.ts - MultiApplyDiffTool.ts - SearchAndReplaceTool.ts - SearchReplaceTool.ts - EditFileTool.ts
This commit is contained in:
parent
7f2978abad
commit
18b05ffb53
6 changed files with 30 additions and 0 deletions
|
|
@ -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(() => {})
|
||||
|
||||
// Direct file write without diff view
|
||||
const completeMessage = JSON.stringify({
|
||||
...sharedMessageProps,
|
||||
|
|
|
|||
|
|
@ -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(() => {})
|
||||
}
|
||||
|
||||
// Show diff view if focus disruption prevention is disabled
|
||||
if (!isPreventFocusDisruptionEnabled) {
|
||||
await task.diffViewProvider.open(relPath)
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue