Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

agent: Make Markdown codeblocks expanded by default (#30806)

Danilo Lealdfe37b0a079f
diff --git a/crates/agent/src/active_thread.rs b/crates/agent/src/active_thread.rs
index 283db91ee00..e888ea61e09 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;
}
}