From bc7fb9f253d023196b6aa6992de2cec07abe8b38 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 7 Mar 2024 23:35:48 +0800 Subject: [PATCH] Show tooltip with item paths for recent project picker items (#8987) Before ![empty-tooltip](https://github.com/zed-industries/zed/assets/5518/4a00158c-5ae1-4ef9-8686-d4c188a99050) After ![output](https://github.com/zed-industries/zed/assets/5518/b30f8272-485d-40e1-989a-facd122e96c8) Release Notes: - Fixed empty tooltip for recent projects picker items --- crates/recent_projects/src/recent_projects.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/recent_projects/src/recent_projects.rs b/crates/recent_projects/src/recent_projects.rs index a9ceefee6d8cc98a1786cb907ef7cfb9103b8d0e..3655fbb6e6a2a5f6df3264d864b605c093004183 100644 --- a/crates/recent_projects/src/recent_projects.rs +++ b/crates/recent_projects/src/recent_projects.rs @@ -325,14 +325,21 @@ impl PickerDelegate for RecentProjectsDelegate { let highlighted_match = HighlightedMatchWithPaths { match_label: HighlightedText::join(match_labels.into_iter().flatten(), ", "), - paths: if self.render_paths { paths } else { Vec::new() }, + paths, }; + Some( ListItem::new(ix) .inset(true) .spacing(ListItemSpacing::Sparse) .selected(selected) - .child(highlighted_match.clone().render(cx)) + .child({ + let mut highlighted = highlighted_match.clone(); + if !self.render_paths { + highlighted.paths.clear(); + } + highlighted.render(cx) + }) .when(!is_current_workspace, |el| { let delete_button = div() .child( @@ -344,7 +351,7 @@ impl PickerDelegate for RecentProjectsDelegate { this.delegate.delete_recent_project(ix, cx) })) - .tooltip(|cx| Tooltip::text("Delete From Recent Projects...", cx)), + .tooltip(|cx| Tooltip::text("Delete from Recent Projects...", cx)), ) .into_any_element();