windows: User installed language server support (#9606)

Release Notes:

- N/A
This commit is contained in:
Ezekiel Warren 2024-03-21 15:25:26 -07:00 committed by GitHub
parent 4183805a39
commit 0f15fd37d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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,