diff --git a/crates/languages/src/python.rs b/crates/languages/src/python.rs index 607140e33a..9c22b54bc8 100644 --- a/crates/languages/src/python.rs +++ b/crates/languages/src/python.rs @@ -770,6 +770,12 @@ impl PyLspAdapter { } } +const BINARY_DIR: &str = if cfg!(target_os = "windows") { + "Scripts" +} else { + "bin" +}; + #[async_trait(?Send)] impl LspAdapter for PyLspAdapter { fn name(&self) -> LanguageServerName { @@ -811,7 +817,7 @@ impl LspAdapter for PyLspAdapter { delegate: &dyn LspAdapterDelegate, ) -> Result { let venv = self.base_venv(delegate).await.map_err(|e| anyhow!(e))?; - let pip_path = venv.join("bin").join("pip3"); + let pip_path = venv.join(BINARY_DIR).join("pip3"); ensure!( util::command::new_smol_command(pip_path.as_path()) .arg("install") @@ -842,7 +848,7 @@ impl LspAdapter for PyLspAdapter { .success(), "pylsp-mypy installation failed" ); - let pylsp = venv.join("bin").join("pylsp"); + let pylsp = venv.join(BINARY_DIR).join("pylsp"); Ok(LanguageServerBinary { path: pylsp, env: None, @@ -856,7 +862,7 @@ impl LspAdapter for PyLspAdapter { delegate: &dyn LspAdapterDelegate, ) -> Option { let venv = self.base_venv(delegate).await.ok()?; - let pylsp = venv.join("bin").join("pylsp"); + let pylsp = venv.join(BINARY_DIR).join("pylsp"); Some(LanguageServerBinary { path: pylsp, env: None,