Fix "select toolchain path" in WSL with python virtual environments (#40447)
Closes #39596 Release Notes: - N/A
This commit is contained in:
@@ -128,66 +128,67 @@ impl AddToolchainState {
|
||||
) -> (OpenPathDelegate, oneshot::Receiver<Option<Vec<PathBuf>>>) {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
let weak = cx.weak_entity();
|
||||
let lister = OpenPathDelegate::new(
|
||||
tx,
|
||||
DirectoryLister::Project(project),
|
||||
false,
|
||||
PathStyle::local(),
|
||||
)
|
||||
.show_hidden()
|
||||
.with_footer(Arc::new(move |_, cx| {
|
||||
let error = weak
|
||||
.read_with(cx, |this, _| {
|
||||
if let AddState::Path { error, .. } = &this.state {
|
||||
error.clone()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.ok()
|
||||
.flatten();
|
||||
let is_loading = weak
|
||||
.read_with(cx, |this, _| {
|
||||
matches!(
|
||||
this.state,
|
||||
AddState::Path {
|
||||
input_state: PathInputState::Resolving(_),
|
||||
..
|
||||
}
|
||||
let path_style = project.read(cx).path_style(cx);
|
||||
let lister =
|
||||
OpenPathDelegate::new(tx, DirectoryLister::Project(project), false, path_style)
|
||||
.show_hidden()
|
||||
.with_footer(Arc::new(move |_, cx| {
|
||||
let error = weak
|
||||
.read_with(cx, |this, _| {
|
||||
if let AddState::Path { error, .. } = &this.state {
|
||||
error.clone()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.ok()
|
||||
.flatten();
|
||||
let is_loading = weak
|
||||
.read_with(cx, |this, _| {
|
||||
matches!(
|
||||
this.state,
|
||||
AddState::Path {
|
||||
input_state: PathInputState::Resolving(_),
|
||||
..
|
||||
}
|
||||
)
|
||||
})
|
||||
.unwrap_or_default();
|
||||
Some(
|
||||
v_flex()
|
||||
.child(Divider::horizontal())
|
||||
.child(
|
||||
h_flex()
|
||||
.p_1()
|
||||
.justify_between()
|
||||
.gap_2()
|
||||
.child(
|
||||
Label::new("Select Toolchain Path")
|
||||
.color(Color::Muted)
|
||||
.map(|this| {
|
||||
if is_loading {
|
||||
this.with_animation(
|
||||
"select-toolchain-label",
|
||||
Animation::new(Duration::from_secs(2))
|
||||
.repeat()
|
||||
.with_easing(pulsating_between(
|
||||
0.4, 0.8,
|
||||
)),
|
||||
|label, delta| label.alpha(delta),
|
||||
)
|
||||
.into_any()
|
||||
} else {
|
||||
this.into_any_element()
|
||||
}
|
||||
}),
|
||||
)
|
||||
.when_some(error, |this, error| {
|
||||
this.child(Label::new(error).color(Color::Error))
|
||||
}),
|
||||
)
|
||||
.into_any(),
|
||||
)
|
||||
})
|
||||
.unwrap_or_default();
|
||||
Some(
|
||||
v_flex()
|
||||
.child(Divider::horizontal())
|
||||
.child(
|
||||
h_flex()
|
||||
.p_1()
|
||||
.justify_between()
|
||||
.gap_2()
|
||||
.child(Label::new("Select Toolchain Path").color(Color::Muted).map(
|
||||
|this| {
|
||||
if is_loading {
|
||||
this.with_animation(
|
||||
"select-toolchain-label",
|
||||
Animation::new(Duration::from_secs(2))
|
||||
.repeat()
|
||||
.with_easing(pulsating_between(0.4, 0.8)),
|
||||
|label, delta| label.alpha(delta),
|
||||
)
|
||||
.into_any()
|
||||
} else {
|
||||
this.into_any_element()
|
||||
}
|
||||
},
|
||||
))
|
||||
.when_some(error, |this, error| {
|
||||
this.child(Label::new(error).color(Color::Error))
|
||||
}),
|
||||
)
|
||||
.into_any(),
|
||||
)
|
||||
}));
|
||||
}));
|
||||
|
||||
(lister, rx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user