Skip to content

Commit

Permalink
assistant2: Don't render the context space if there's none (zed-indus…
Browse files Browse the repository at this point in the history
…tries#22383)

Note the extra bottom space on the before version. That was because,
previously, the container that holds the context pills in an active
thread was being rendered even if there was no attached context.

| Before | After |
|--------|--------|
| <img width="1577" alt="Screenshot 2024-12-23 at 8 42 00 PM"
src="https://github.com/user-attachments/assets/b74bdc67-0a08-4d59-b1ec-43a00a59a373"
/> | <img width="1577" alt="Screenshot 2024-12-23 at 8 39 00 PM"
src="https://github.com/user-attachments/assets/1cbc340d-19df-4cce-8c0b-b671703a0ff5"
/> |

Release Notes:

- N/A
  • Loading branch information
danilo-leal authored and helgemahrt committed Jan 1, 2025
1 parent 26cbc9f commit e1f11f1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions crates/assistant2/src/active_thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,18 @@ impl ActiveThread {
)
.child(v_flex().p_2p5().text_ui(cx).child(markdown.clone()))
.when_some(context, |parent, context| {
parent.child(
h_flex().flex_wrap().gap_1().p_1p5().children(
context
.iter()
.map(|context| ContextPill::new(context.clone())),
),
)
if !context.is_empty() {
parent.child(
h_flex()
.flex_wrap()
.gap_1()
.px_1p5()
.pb_1p5()
.children(context.iter().map(|c| ContextPill::new(c.clone()))),
)
} else {
parent
}
}),
)
.into_any()
Expand Down

0 comments on commit e1f11f1

Please sign in to comment.