From ea5f3e6086e48058020860dd812ae34fd4e27019 Mon Sep 17 00:00:00 2001 From: ming_jiang Date: Tue, 21 Oct 2025 00:12:05 +0800 Subject: [PATCH] Fix PATH lookup to handle Windows case sensitivity (#40711) Closes #40448 On Windows, PATH might be "Path" instead of "PATH" Release Notes: - N/A *or* Added/Fixed/Improved ... --- crates/project/src/lsp_store.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs index c68d14d38866b2fbe8a97792bdf46a94469124a1..e8eaa493de9dc14493c95307b42f04711b4eaca0 100644 --- a/crates/project/src/lsp_store.rs +++ b/crates/project/src/lsp_store.rs @@ -12760,7 +12760,16 @@ impl LspAdapterDelegate for LocalLspAdapterDelegate { if self.fs.is_file(&worktree_abs_path).await { worktree_abs_path.pop(); } - let shell_path = self.shell_env().await.get("PATH").cloned(); + + let env = self.shell_env().await; + + // On Windows, PATH might be "Path" instead of "PATH" + let shell_path = env + .get("PATH") + .or_else(|| env.get("Path")) + .or_else(|| env.get("path")) + .cloned(); + which::which_in(command, shell_path.as_ref(), worktree_abs_path).ok() }