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 ...
This commit is contained in:
ming_jiang
2025-10-20 16:12:05 +00:00
committed by GitHub
parent db404fc2e3
commit ea5f3e6086
+10 -1
View File
@@ -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()
}