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

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-05-16 06:48:15 -03:00 committed by GitHub
parent 2da37988b5
commit dfe37b0a07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
}
}