windows: User installed language server support (#9606)

Ezekiel Warren created

Release Notes:

- N/A

Change summary

crates/project/src/project.rs | 9 +++++++++
1 file changed, 9 insertions(+)

Detailed changes

crates/project/src/project.rs 🔗

@@ -9540,6 +9540,7 @@ impl LspAdapterDelegate for ProjectLspAdapterDelegate {
         self.shell_env.lock().as_ref().cloned().unwrap_or_default()
     }
 
+    #[cfg(not(target_os = "windows"))]
     async fn which(&self, command: &OsStr) -> Option<PathBuf> {
         let worktree_abs_path = self.worktree.abs_path();
         self.load_shell_env().await;
@@ -9551,6 +9552,14 @@ impl LspAdapterDelegate for ProjectLspAdapterDelegate {
         which::which_in(command, shell_path.as_ref(), &worktree_abs_path).ok()
     }
 
+    #[cfg(target_os = "windows")]
+    async fn which(&self, command: &OsStr) -> Option<PathBuf> {
+        // 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()
+    }
+
     fn update_status(
         &self,
         server_name: LanguageServerName,