Conversation
cachebag
force-pushed
the
agent-collapse-tool-cards-by-default
branch
2 times, most recently
from
September 26, 2026 15:28
b331c2b to
dfa94c0
Compare
Adds MarkdownElement::collapse_code_blocks. Collapsed blocks render as a single row with the language and line count, expand on click, and get a collapse button in the hover toolbar. A block containing the active search match stays open so the match is never hidden.
When false, fenced code blocks in agent messages start collapsed and can be expanded individually. Complements expand_edit_card and expand_terminal_card. Tool output and compaction summaries are unaffected. Addresses zed-industries#58333
cachebag
force-pushed
the
agent-collapse-tool-cards-by-default
branch
from
September 27, 2026 00:51
dfa94c0 to
b7be823
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Addresses #58333.
Long ACP agent turns are hard to scan because verbose blocks push the prose apart. Diff and terminal cards are already configurable via
expand_edit_card/expand_terminal_card, but fenced code blocks inside agent messages had no collapse at all.Code-heavy responses therefore dominated the thread with no settings-only workaround and this has been a really frustrating for many users, including me, as it makes a lot of the agent output borderline unreadable.
Solution
Adds
agent.expand_code_block(this is defaulted totrue).When set to
false, code blocks in agent messages render as a single row showing the language and line count (for examplerust · 42 lines). Clicking the row expands the block, and the hover toolbar on an expanded block gains a collapse button next to the existing wrap and copy buttons. A block that contains the active in-thread search match stays open so navigating between matches never lands on hidden text.markdown: newMarkdownElement::collapse_code_blocksoption. Collapsed blocks skip content layout entirely and render a summary row instead. Per-block expanded state lives on theMarkdownentity, keyed by source offset like the existingwrapped_code_blocks, so it survives re-renders and streaming appends.settings_content/agent_settings/default.json/ settings UI: the new setting, alongsideexpand_edit_cardandexpand_terminal_card.agent_ui: applies the setting to assistant message content only. Tool output and compaction summaries are already collapsible as a whole and are left unchanged.Testing
Ideally, some candidates from #58333 can also take a look and try it for themselves and post screenshots
Here are some code blocks with the setting on:

And with the setting disabled:

I wrote and tested this patch on macOS and tested on Linux but not on Windows
Self-Review Checklist:
Release Notes:
agent.expand_code_blocksetting to have code blocks in agent messages start collapsed, expandable individually.