mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
Add WSL distro labels to open recent (#40375)
Closes #40358 Release Notes: - Windows: improved recently open folders in WSL
This commit is contained in:
parent
3da4cddce2
commit
c5a67d85ab
2 changed files with 17 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ use ui::{HighlightedLabel, prelude::*};
|
|||
|
||||
#[derive(Clone)]
|
||||
pub struct HighlightedMatchWithPaths {
|
||||
pub prefix: Option<SharedString>,
|
||||
pub match_label: HighlightedMatch,
|
||||
pub paths: Vec<HighlightedMatch>,
|
||||
}
|
||||
|
|
@ -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)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue