From e67065f2a3070504396f39e911c97c3fec9b942e Mon Sep 17 00:00:00 2001 From: Julia Ryan Date: Thu, 16 Oct 2025 23:02:49 -0700 Subject: [PATCH] Fix "select toolchain path" in WSL with python virtual environments (#40447) Closes #39596 Release Notes: - N/A --- .../src/toolchain_selector.rs | 119 +++++++++--------- 1 file changed, 60 insertions(+), 59 deletions(-) diff --git a/crates/toolchain_selector/src/toolchain_selector.rs b/crates/toolchain_selector/src/toolchain_selector.rs index 432f5c1730502eed43e2c11c8ef573f66eee4fb3..e816bec2ff26e7b8db81cf800307cbab91557712 100644 --- a/crates/toolchain_selector/src/toolchain_selector.rs +++ b/crates/toolchain_selector/src/toolchain_selector.rs @@ -128,66 +128,67 @@ impl AddToolchainState { ) -> (OpenPathDelegate, oneshot::Receiver>>) { 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(_), - .. - } - ) - }) - .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)) - }), + 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(), ) - .into_any(), - ) - })); + })); (lister, rx) }