Skip to content

feat: add setting to auto-expand diffs in edit messages#12151

Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
feature/auto-expand-diffs-v2
Draft

feat: add setting to auto-expand diffs in edit messages#12151
roomote-v0[bot] wants to merge 1 commit intomainfrom
feature/auto-expand-diffs-v2

Conversation

@roomote-v0
Copy link
Copy Markdown
Contributor

@roomote-v0 roomote-v0 bot commented Apr 19, 2026

Related GitHub Issue

Closes: #10955

Description

This PR attempts to address Issue #10955 by adding an autoExpandDiffs setting that automatically expands code diffs in "Roo wants to edit this file" chat messages. This addresses the frustration of having to click on each collapsed diff block while the chat is scrolling.

Implementation details:

  • Added autoExpandDiffs boolean to GlobalSettings schema (default: false)
  • Added the setting to ExtensionState type so it flows from backend to frontend
  • Added a checkbox under Settings > UI: "Auto-expand diffs in edit messages"
  • In ChatView, diff tool messages are auto-expanded when the setting is enabled
  • User can still manually collapse individual diffs (explicit toggle overrides auto-expand)
  • Works with all diff tool types: editedExistingFile, appliedDiff, newFileCreated, searchAndReplace, insertContent, apply_patch, apply_diff, etc.
  • Diffs still respect the existing 300px max-height with scrollbar, so they do not take over the chat view

Files changed:

  • packages/types/src/global-settings.ts - Added autoExpandDiffs to schema
  • packages/types/src/vscode-extension-host.ts - Added to ExtensionState pick type
  • webview-ui/src/context/ExtensionStateContext.tsx - Added state and setter
  • src/core/webview/ClineProvider.ts - Broadcast setting in state
  • webview-ui/src/components/settings/UISettings.tsx - Added checkbox UI
  • webview-ui/src/components/settings/SettingsView.tsx - Wired setting through
  • webview-ui/src/i18n/locales/en/settings.json - Added English locale strings
  • webview-ui/src/components/chat/ChatView.tsx - Auto-expand logic for diff messages

Test Procedure

  1. Enable the setting under Settings > UI > "Auto-expand diffs in edit messages"
  2. Start a task that edits files
  3. Observe that diff blocks in "Roo wants to edit this file" messages are expanded by default
  4. Click a diff to collapse it -- it should stay collapsed (user override)
  5. Disable the setting and confirm diffs go back to collapsed by default

Automated tests:

  • Updated UISettings.spec.tsx with 3 new tests for the auto-expand checkbox
  • Updated SettingsView.change-detection.spec.tsx and SettingsView.unsaved-changes.spec.tsx fixtures
  • All existing and new tests pass

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes.
  • Documentation Impact: No documentation updates needed for this UI setting.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Feedback and guidance are welcome.

Interactively review PR in Roo Code Cloud

Adds a new "Auto-expand diffs in edit messages" setting under
Settings > UI that, when enabled, automatically expands code diffs
in "Roo wants to edit this file" chat messages instead of requiring
users to click each one.

The setting:
- Defaults to false (preserving current collapsed behavior)
- Respects user toggles (clicking to collapse overrides auto-expand)
- Works with all diff tool types (editedExistingFile, appliedDiff,
  newFileCreated, searchAndReplace, insertContent, etc.)
- Diffs still respect the existing 300px max-height with scrollbar

Closes #10955
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add setting to auto-expand diffs in "Roo wants to edit this file" chat messages

1 participant