From a6e99c1c161cdb869f643f570e9cea79963f19db Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 15 Oct 2025 10:06:37 +0200 Subject: [PATCH] project: Always use shell env in `LocalLspAdapterDelegate::which` (#40237) Windows not having a default shell does not matter here, we might still have an environment from other means (by being spawned from the cli for example). Release Notes: - N/A *or* Added/Fixed/Improved ... --- crates/project/src/lsp_store.rs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs index 80d32e16690bf1bcb7bdec9d868193dd972f3614..f899c3a88645d45f0b302669e4a54b9134c911b4 100644 --- a/crates/project/src/lsp_store.rs +++ b/crates/project/src/lsp_store.rs @@ -12750,7 +12750,6 @@ impl LspAdapterDelegate for LocalLspAdapterDelegate { return Ok(None); } - #[cfg(not(target_os = "windows"))] async fn which(&self, command: &OsStr) -> Option { let mut worktree_abs_path = self.worktree_root_path().to_path_buf(); if self.fs.is_file(&worktree_abs_path).await { @@ -12760,14 +12759,6 @@ impl LspAdapterDelegate for LocalLspAdapterDelegate { which::which_in(command, shell_path.as_ref(), worktree_abs_path).ok() } - #[cfg(target_os = "windows")] - async fn which(&self, command: &OsStr) -> Option { - // todo(windows) Getting the shell env variables in a current directory on Windows is more complicated than other platforms - // there isn't a 'default shell' necessarily. The closest would be the default profile on the windows terminal - // SEE: https://learn.microsoft.com/en-us/windows/terminal/customize-settings/startup - which::which(command).ok() - } - async fn try_exec(&self, command: LanguageServerBinary) -> Result<()> { let mut working_dir = self.worktree_root_path().to_path_buf(); if self.fs.is_file(&working_dir).await {