Skip to content
Open
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
5 changes: 5 additions & 0 deletions assets/settings/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,11 @@
//
// Default: true
"expand_terminal_card": true,
// Whether to have code blocks in agent messages expanded, showing the whole code.
// When disabled, code blocks start collapsed and can be expanded individually.
//
// Default: true
"expand_code_block": true,
// Command to automatically run when Zed creates a Terminal Thread shell in the agent panel.
// The command is sent to the shell as if typed, so it is interpreted by your
// configured shell (including on Windows and remote/WSL projects).
Expand Down
1 change: 1 addition & 0 deletions crates/agent/src/tool_permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ mod tests {
enable_feedback: false,
expand_edit_card: true,
expand_terminal_card: true,
expand_code_block: true,
terminal_init_command: None,
cancel_generation_on_terminal_stop: true,
use_modifier_to_send: true,
Expand Down
2 changes: 2 additions & 0 deletions crates/agent_settings/src/agent_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ pub struct AgentSettings {
pub enable_feedback: bool,
pub expand_edit_card: bool,
pub expand_terminal_card: bool,
pub expand_code_block: bool,
pub terminal_init_command: Option<String>,
pub thinking_display: ThinkingBlockDisplay,
pub cancel_generation_on_terminal_stop: bool,
Expand Down Expand Up @@ -833,6 +834,7 @@ impl Settings for AgentSettings {
enable_feedback: agent.enable_feedback.unwrap(),
expand_edit_card: agent.expand_edit_card.unwrap(),
expand_terminal_card: agent.expand_terminal_card.unwrap(),
expand_code_block: agent.expand_code_block.unwrap(),
terminal_init_command: agent
.terminal_init_command
.filter(|command| !command.trim().is_empty()),
Expand Down
1 change: 1 addition & 0 deletions crates/agent_ui/src/agent_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@ mod tests {
enable_feedback: false,
expand_edit_card: true,
expand_terminal_card: true,
expand_code_block: true,
terminal_init_command: None,
cancel_generation_on_terminal_stop: true,
use_modifier_to_send: true,
Expand Down
14 changes: 13 additions & 1 deletion crates/agent_ui/src/conversation_view/thread_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3955,6 +3955,7 @@ impl ThreadView {
content.as_view(),
None,
true,
false,
window,
cx,
)
Expand Down Expand Up @@ -7385,14 +7386,22 @@ impl ThreadView {
window: &Window,
cx: &Context<Self>,
) -> Div {
let collapse_code_blocks = !AgentSettings::get_global(cx).expand_code_block;
v_flex().w_full().gap_3().children(
content
.blocks()
.enumerate()
.filter(|(_, block)| block.visible_content(cx))
.map(|(block_ix, block)| {
let content = self.render_output_content_block(
entry_ix, block_ix, block, None, false, window, cx,
entry_ix,
block_ix,
block,
None,
false,
collapse_code_blocks,
window,
cx,
);
div()
.id(("message-content-block", block_ix))
Expand Down Expand Up @@ -10189,6 +10198,7 @@ impl ThreadView {
content.as_view(),
Some(tool_call),
card_layout,
false,
window,
cx,
),
Expand All @@ -10215,6 +10225,7 @@ impl ThreadView {
content: acp_thread::ContentBlockView<'_>,
tool_call: Option<&ToolCall>,
card_layout: bool,
collapse_code_blocks: bool,
window: &Window,
cx: &Context<Self>,
) -> AnyElement {
Expand All @@ -10235,6 +10246,7 @@ impl ThreadView {
MarkdownStyle::themed(MarkdownFont::Agent, window, cx),
cx,
)
.collapse_code_blocks(collapse_code_blocks)
.into_any()
}
} else if let Some((resource, _)) = content.embedded_resource() {
Expand Down
Loading