Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

python: Adjust binary path based on OS (#22587)

Torrat53cfb578e8ec
diff --git a/crates/languages/src/python.rs b/crates/languages/src/python.rs
index 607140e33af..9c22b54bc87 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<LanguageServerBinary> {
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<LanguageServerBinary> {
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,