Skip to content

Commit 7828780

Browse files
localccxipeng-jin
authored andcommitted
Add WSL distro labels to open recent (zed-industries#40375)
Closes zed-industries#40358 Release Notes: - Windows: improved recently open folders in WSL
1 parent e78e39c commit 7828780

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

crates/picker/src/highlighted_match_with_paths.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use ui::{HighlightedLabel, prelude::*};
22

33
#[derive(Clone)]
44
pub struct HighlightedMatchWithPaths {
5+
pub prefix: Option<SharedString>,
56
pub match_label: HighlightedMatch,
67
pub paths: Vec<HighlightedMatch>,
78
}
@@ -67,7 +68,14 @@ impl HighlightedMatchWithPaths {
6768
impl RenderOnce for HighlightedMatchWithPaths {
6869
fn render(mut self, _window: &mut Window, _: &mut App) -> impl IntoElement {
6970
v_flex()
70-
.child(self.match_label.clone())
71+
.child(
72+
h_flex().gap_1().child(self.match_label.clone()).when_some(
73+
self.prefix.as_ref(),
74+
|this, prefix| {
75+
this.child(Label::new(format!("({})", prefix)).color(Color::Muted))
76+
},
77+
),
78+
)
7179
.when(!self.paths.is_empty(), |this| {
7280
self.render_paths_children(this)
7381
})

crates/recent_projects/src/recent_projects.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,15 @@ impl PickerDelegate for RecentProjectsDelegate {
471471
})
472472
.unzip();
473473

474+
let prefix = match &location {
475+
SerializedWorkspaceLocation::Remote(RemoteConnectionOptions::Wsl(wsl)) => {
476+
Some(SharedString::from(&wsl.distro_name))
477+
}
478+
_ => None,
479+
};
480+
474481
let highlighted_match = HighlightedMatchWithPaths {
482+
prefix,
475483
match_label: HighlightedMatch::join(match_labels.into_iter().flatten(), ", "),
476484
paths,
477485
};

0 commit comments

Comments
 (0)