diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs index db43fe5f8a27d85d5b566900125d493accc82187..c61854132c68792e85d09d706fd63fd3b8110743 100644 --- a/crates/agent_ui/src/acp/thread_view.rs +++ b/crates/agent_ui/src/acp/thread_view.rs @@ -294,7 +294,6 @@ pub struct AcpThreadView { resume_thread_metadata: Option, _cancel_task: Option>, _subscriptions: [Subscription; 5], - #[cfg(target_os = "windows")] show_codex_windows_warning: bool, } @@ -401,7 +400,6 @@ impl AcpThreadView { ), ]; - #[cfg(target_os = "windows")] let show_codex_windows_warning = crate::ExternalAgent::parse_built_in(agent.as_ref()) == Some(crate::ExternalAgent::Codex); @@ -447,7 +445,6 @@ impl AcpThreadView { focus_handle: cx.focus_handle(), new_server_version_available: None, resume_thread_metadata: resume_thread, - #[cfg(target_os = "windows")] show_codex_windows_warning, } } @@ -5252,7 +5249,6 @@ impl AcpThreadView { ) } - #[cfg(target_os = "windows")] fn render_codex_windows_warning(&self, cx: &mut Context) -> Option { if self.show_codex_windows_warning { Some( @@ -5268,8 +5264,9 @@ impl AcpThreadView { .icon_size(IconSize::Small) .icon_color(Color::Muted) .on_click(cx.listener({ - move |_, _, window, cx| { - window.dispatch_action( + move |_, _, _window, cx| { + #[cfg(windows)] + _window.dispatch_action( zed_actions::wsl_actions::OpenWsl::default().boxed_clone(), cx, ); @@ -5772,13 +5769,15 @@ impl Render for AcpThreadView { }) .children(self.render_thread_retry_status_callout(window, cx)) .children({ - #[cfg(target_os = "windows")] + if self + .project + .read(cx) + .remote_connection_options(cx) + .is_some_and(|it| it.is_wsl()) { self.render_codex_windows_warning(cx) - } - #[cfg(not(target_os = "windows"))] - { - Vec::::new() + } else { + None } }) .children(self.render_thread_error(cx)) diff --git a/crates/remote/src/remote_client.rs b/crates/remote/src/remote_client.rs index 54ec6644b9abef23446aaf0f8ddd21c0da6bdf05..554e6ee1c496fe9fcef47203c2c657fc9ac24079 100644 --- a/crates/remote/src/remote_client.rs +++ b/crates/remote/src/remote_client.rs @@ -1077,6 +1077,10 @@ impl RemoteConnectionOptions { RemoteConnectionOptions::Wsl(opts) => opts.distro_name.clone(), } } + + pub fn is_wsl(&self) -> bool { + matches!(self, RemoteConnectionOptions::Wsl(_)) + } } impl From for RemoteConnectionOptions {