Compare commits

...
Author SHA1 Message Date
Robin Newhouse e814c98c31 chore: add changeset for early feedback feature 2026-01-21 18:19:21 -08:00
Robin Newhouse d3a02186aa feat: Show early feedback when editing files
When the model generates large diffs (especially for notebooks), there
was a long perceived delay between the model's thinking and the edit
dialog appearing. The file path is available within milliseconds, but
the UI waited for diff content to start streaming.

Now shows "Preparing to edit {filename}..." immediately when a complete
file path is detected, giving users instant feedback that an edit is
in progress.
2026-01-21 17:46:52 -08:00
2 changed files with 26 additions and 0 deletions
@@ -0,0 +1,7 @@
---
"claude-dev": patch
---
feat: Show early feedback when editing files
Display immediate visual feedback in the diff view when file edits begin, improving user experience by showing progress earlier instead of waiting for the first content chunk to arrive.
@@ -29,17 +29,36 @@ export class WriteToFileToolHandler implements IFullyManagedTool {
return `[${block.name} for '${block.params.path || block.params.absolutePath}']`
}
private _shownPathOnlyMessage = false
async handlePartialBlock(block: ToolUse, uiHelpers: StronglyTypedUIHelpers): Promise<void> {
const rawRelPath = block.params.path || block.params.absolutePath
const rawContent = block.params.content // for write_to_file
const rawDiff = block.params.diff // for replace_in_file
// Show early UI feedback when we have a complete path but no content yet
// This prevents the UI from appearing stuck while the model streams the diff
// A path is "complete" if it has a file extension (e.g., .ts, .ipynb, .py)
const pathLooksComplete = rawRelPath && /\.\w{1,10}$/.test(rawRelPath)
if (pathLooksComplete && !rawContent && !rawDiff && !this._shownPathOnlyMessage) {
this._shownPathOnlyMessage = true
const config = uiHelpers.getConfig()
const readablePath = getReadablePath(config.cwd, rawRelPath)
// Show a simple text message that Cline is preparing to edit the file
// This gives immediate feedback while the model generates the diff content
await uiHelpers.say("text", `Preparing to edit ${readablePath}...`, undefined, undefined, true)
return
}
// Early return if we don't have enough data yet
if (!rawRelPath || (!rawContent && !rawDiff)) {
// Wait until we have the path and either content or diff
return
}
// Reset the path-only flag since we now have content
this._shownPathOnlyMessage = false
const config = uiHelpers.getConfig()
// Creates file if it doesn't exist, and opens editor to stream content in. We don't want to handle this in the try/catch below since the error handler for it resets the diff view, which wouldn't be open if this failed.