From 45d200f2f8b86605c5137bf49441c74b5288cc51 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Wed, 9 Jul 2025 14:44:29 +0300 Subject: [PATCH 001/396] Wrap back around in context menu properly (#34112) When navigating back in the context menu, it was not possible to get past first element, if it was not selectable. The other way around works, hence the fix. Release Notes: - N/A --- crates/language_tools/src/lsp_tool.rs | 2 - crates/ui/Cargo.toml | 3 + crates/ui/src/components/context_menu.rs | 89 +++++++++++++++++++++--- 3 files changed, 81 insertions(+), 13 deletions(-) diff --git a/crates/language_tools/src/lsp_tool.rs b/crates/language_tools/src/lsp_tool.rs index 81cc38d33f..9e542f582a 100644 --- a/crates/language_tools/src/lsp_tool.rs +++ b/crates/language_tools/src/lsp_tool.rs @@ -735,8 +735,6 @@ impl LspTool { state.update(cx, |state, cx| state.fill_menu(menu, cx)) }); lsp_tool.lsp_menu = Some(menu.clone()); - // TODO kb will this work? - // what about the selections? lsp_tool.popover_menu_handle.refresh_menu( window, cx, diff --git a/crates/ui/Cargo.toml b/crates/ui/Cargo.toml index 625bdc62f5..c047291772 100644 --- a/crates/ui/Cargo.toml +++ b/crates/ui/Cargo.toml @@ -34,6 +34,9 @@ workspace-hack.workspace = true [target.'cfg(windows)'.dependencies] windows.workspace = true +[dev-dependencies] +gpui = { workspace = true, features = ["test-support"] } + [features] default = [] stories = ["dep:story"] diff --git a/crates/ui/src/components/context_menu.rs b/crates/ui/src/components/context_menu.rs index 075cf7a7d7..873b7b9e63 100644 --- a/crates/ui/src/components/context_menu.rs +++ b/crates/ui/src/components/context_menu.rs @@ -690,20 +690,15 @@ impl ContextMenu { cx: &mut Context, ) { if let Some(ix) = self.selected_index { - if ix == 0 { - self.handle_select_last(&SelectLast, window, cx); - } else { - for (ix, item) in self.items.iter().enumerate().take(ix).rev() { - if item.is_selectable() { - self.select_index(ix, window, cx); - cx.notify(); - break; - } + for (ix, item) in self.items.iter().enumerate().take(ix).rev() { + if item.is_selectable() { + self.select_index(ix, window, cx); + cx.notify(); + return; } } - } else { - self.handle_select_last(&SelectLast, window, cx); } + self.handle_select_last(&SelectLast, window, cx); } fn select_index( @@ -1171,3 +1166,75 @@ impl Render for ContextMenu { }))) } } + +#[cfg(test)] +mod tests { + use gpui::TestAppContext; + + use super::*; + + #[gpui::test] + fn can_navigate_back_over_headers(cx: &mut TestAppContext) { + let cx = cx.add_empty_window(); + let context_menu = cx.update(|window, cx| { + ContextMenu::build(window, cx, |menu, _, _| { + menu.header("First header") + .separator() + .entry("First entry", None, |_, _| {}) + .separator() + .separator() + .entry("Last entry", None, |_, _| {}) + }) + }); + + context_menu.update_in(cx, |context_menu, window, cx| { + assert_eq!( + None, context_menu.selected_index, + "No selection is in the menu initially" + ); + + context_menu.select_first(&SelectFirst, window, cx); + assert_eq!( + Some(2), + context_menu.selected_index, + "Should select first selectable entry, skipping the header and the separator" + ); + + context_menu.select_next(&SelectNext, window, cx); + assert_eq!( + Some(5), + context_menu.selected_index, + "Should select next selectable entry, skipping 2 separators along the way" + ); + + context_menu.select_next(&SelectNext, window, cx); + assert_eq!( + Some(2), + context_menu.selected_index, + "Should wrap around to first selectable entry" + ); + }); + + context_menu.update_in(cx, |context_menu, window, cx| { + assert_eq!( + Some(2), + context_menu.selected_index, + "Should start from the first selectable entry" + ); + + context_menu.select_previous(&SelectPrevious, window, cx); + assert_eq!( + Some(5), + context_menu.selected_index, + "Should wrap around to previous selectable entry (last)" + ); + + context_menu.select_previous(&SelectPrevious, window, cx); + assert_eq!( + Some(2), + context_menu.selected_index, + "Should go back to previous selectable entry (first)" + ); + }); + } +} From 7114a5ca99aa14016a278100f136a32dd7911521 Mon Sep 17 00:00:00 2001 From: Bennet Bo Fenner Date: Wed, 9 Jul 2025 16:39:02 +0200 Subject: [PATCH 002/396] Fix panic in context server configuration (#34118) Release Notes: - Fixed a panic that could occur when configuring MCP servers --- .../src/agent_configuration/configure_context_server_modal.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs b/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs index ba0021c33c..9e5f6e09c8 100644 --- a/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs +++ b/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs @@ -740,7 +740,9 @@ fn wait_for_context_server( }); cx.spawn(async move |_cx| { - let result = rx.await.unwrap(); + let result = rx + .await + .map_err(|_| Arc::from("Context server store was dropped"))?; drop(subscription); result }) From 81cc1e8f753222be31ba3df8a912d8f8d71206b6 Mon Sep 17 00:00:00 2001 From: Smit Barmase Date: Wed, 9 Jul 2025 20:26:21 +0530 Subject: [PATCH 003/396] project_panel: Improve last sticky item drifting logic (#34119) - Now instead of drifting directory along with last item of that directory, it waits till last item is completely consumed. Release Notes: - N/A --- crates/ui/src/components/sticky_items.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/crates/ui/src/components/sticky_items.rs b/crates/ui/src/components/sticky_items.rs index da6c14ff09..218f7aae35 100644 --- a/crates/ui/src/components/sticky_items.rs +++ b/crates/ui/src/components/sticky_items.rs @@ -159,10 +159,9 @@ where let mut iter = entries.iter().enumerate().peekable(); while let Some((ix, current_entry)) = iter.next() { - let current_depth = current_entry.depth(); - let index_in_range = ix; + let depth = current_entry.depth(); - if current_depth < index_in_range { + if depth < ix { sticky_anchor = Some(StickyAnchor { entry: current_entry.clone(), index: visible_range.start + ix, @@ -172,9 +171,15 @@ where if let Some(&(_next_ix, next_entry)) = iter.peek() { let next_depth = next_entry.depth(); + let next_item_outdented = next_depth + 1 == depth; - if next_depth < current_depth && next_depth < index_in_range { - last_item_is_drifting = true; + let depth_same_as_index = depth == ix; + let depth_greater_than_index = depth == ix + 1; + + if next_item_outdented && (depth_same_as_index || depth_greater_than_index) { + if depth_greater_than_index { + last_item_is_drifting = true; + } sticky_anchor = Some(StickyAnchor { entry: current_entry.clone(), index: visible_range.start + ix, @@ -216,7 +221,7 @@ where let drifting_y_offset = if last_item_is_drifting { let scroll_top = -scroll_offset.y; - let anchor_top = item_height * sticky_anchor.index; + let anchor_top = item_height * (sticky_anchor.index + 1); let sticky_area_height = item_height * items_count; (anchor_top - scroll_top - sticky_area_height).min(Pixels::ZERO) } else { From a9b82e1e5740f2ee3dfe9265ddb0d430f8c07e50 Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Wed, 9 Jul 2025 11:04:13 -0400 Subject: [PATCH 004/396] Bump Zed to v0.196 (#34127) Release Notes: - N/A --- Cargo.lock | 2 +- crates/zed/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 38bb7819ca..5c22b90526 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19972,7 +19972,7 @@ dependencies = [ [[package]] name = "zed" -version = "0.195.0" +version = "0.196.0" dependencies = [ "activity_indicator", "agent", diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 884443e770..48591d65c1 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -2,7 +2,7 @@ description = "The fast, collaborative code editor." edition.workspace = true name = "zed" -version = "0.195.0" +version = "0.196.0" publish.workspace = true license = "GPL-3.0-or-later" authors = ["Zed Team "] From b9b42bee990dfb94a9c29ab2b4bafae19444395a Mon Sep 17 00:00:00 2001 From: Oleksiy Syvokon Date: Wed, 9 Jul 2025 18:31:58 +0300 Subject: [PATCH 005/396] evals: Fix bug that prevented multiple turns from displaying (#34128) Release Notes: - N/A --- crates/eval/src/explorer.html | 204 +++++++++------------------------- 1 file changed, 54 insertions(+), 150 deletions(-) diff --git a/crates/eval/src/explorer.html b/crates/eval/src/explorer.html index fec4597163..04c41090d3 100644 --- a/crates/eval/src/explorer.html +++ b/crates/eval/src/explorer.html @@ -324,20 +324,8 @@

Thread Explorer

- - + + @@ -368,8 +352,7 @@ ← Previous
- Thread 1 of - 1: + Thread 1 of 1: Default Thread