From c5a67d85abebd06d27ca868c9b6ca500c908c05d Mon Sep 17 00:00:00 2001 From: localcc Date: Thu, 16 Oct 2025 19:07:36 +0200 Subject: [PATCH] Add WSL distro labels to open recent (#40375) Closes #40358 Release Notes: - Windows: improved recently open folders in WSL --- crates/picker/src/highlighted_match_with_paths.rs | 10 +++++++++- crates/recent_projects/src/recent_projects.rs | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/picker/src/highlighted_match_with_paths.rs b/crates/picker/src/highlighted_match_with_paths.rs index 6e91b997da2dab2ac61befd2f596e6f3a4207c85..74271047621b26be573dc2eebfffe9e9e0f1a138 100644 --- a/crates/picker/src/highlighted_match_with_paths.rs +++ b/crates/picker/src/highlighted_match_with_paths.rs @@ -2,6 +2,7 @@ use ui::{HighlightedLabel, prelude::*}; #[derive(Clone)] pub struct HighlightedMatchWithPaths { + pub prefix: Option, pub match_label: HighlightedMatch, pub paths: Vec, } @@ -67,7 +68,14 @@ impl HighlightedMatchWithPaths { impl RenderOnce for HighlightedMatchWithPaths { fn render(mut self, _window: &mut Window, _: &mut App) -> impl IntoElement { v_flex() - .child(self.match_label.clone()) + .child( + h_flex().gap_1().child(self.match_label.clone()).when_some( + self.prefix.as_ref(), + |this, prefix| { + this.child(Label::new(format!("({})", prefix)).color(Color::Muted)) + }, + ), + ) .when(!self.paths.is_empty(), |this| { self.render_paths_children(this) }) diff --git a/crates/recent_projects/src/recent_projects.rs b/crates/recent_projects/src/recent_projects.rs index 104075f474840c2d02971cb516503db62e1dfe4b..12290916e2afe242b2c389da3b971fdfaa9f0eb0 100644 --- a/crates/recent_projects/src/recent_projects.rs +++ b/crates/recent_projects/src/recent_projects.rs @@ -471,7 +471,15 @@ impl PickerDelegate for RecentProjectsDelegate { }) .unzip(); + let prefix = match &location { + SerializedWorkspaceLocation::Remote(RemoteConnectionOptions::Wsl(wsl)) => { + Some(SharedString::from(&wsl.distro_name)) + } + _ => None, + }; + let highlighted_match = HighlightedMatchWithPaths { + prefix, match_label: HighlightedMatch::join(match_labels.into_iter().flatten(), ", "), paths, };