From dfe37b0a079f0bdde6d2327835b5e62ba2168485 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Fri, 16 May 2025 06:48:15 -0300 Subject: [PATCH] agent: Make Markdown codeblocks expanded by default (#30806) Release Notes: - N/A --- crates/agent/src/active_thread.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/agent/src/active_thread.rs b/crates/agent/src/active_thread.rs index 283db91ee0..e888ea61e0 100644 --- a/crates/agent/src/active_thread.rs +++ b/crates/agent/src/active_thread.rs @@ -2363,6 +2363,7 @@ impl ActiveThread { move |el, range, metadata, _, cx| { let can_expand = metadata.line_count >= MAX_UNCOLLAPSED_LINES_IN_CODE_BLOCK; + if !can_expand { return el; } @@ -2370,6 +2371,7 @@ impl ActiveThread { let is_expanded = active_thread .read(cx) .is_codeblock_expanded(message_id, range.start); + if is_expanded { return el; } @@ -3392,14 +3394,14 @@ impl ActiveThread { self.expanded_code_blocks .get(&(message_id, ix)) .copied() - .unwrap_or(false) + .unwrap_or(true) } pub fn toggle_codeblock_expanded(&mut self, message_id: MessageId, ix: usize) { let is_expanded = self .expanded_code_blocks .entry((message_id, ix)) - .or_insert(false); + .or_insert(true); *is_expanded = !*is_expanded; } }