Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Download right language server binary for OS (#8040)
bbb6514616d66e1d72
diff --git a/crates/node_runtime/src/node_runtime.rs b/crates/node_runtime/src/node_runtime.rsindex e40f83fae09..7317635dd10 100644--- a/crates/node_runtime/src/node_runtime.rs+++ b/crates/node_runtime/src/node_runtime.rs@@ -60,13 +60,20 @@ impl RealNodeRuntime {let _lock = self.installation_lock.lock().await;log::info!("Node runtime install_if_needed");+ let os = match consts::OS {+ "macos" => "darwin",+ "linux" => "linux",+ "windows" => "win",+ other => bail!("Running on unsupported os: {other}"),+ };+let arch = match consts::ARCH {"x86_64" => "x64","aarch64" => "arm64",- other => bail!("Running on unsupported platform: {other}"),+ other => bail!("Running on unsupported architecture: {other}"),};- let folder_name = format!("node-{VERSION}-darwin-{arch}");+ let folder_name = format!("node-{VERSION}-{os}-{arch}");let node_containing_dir = util::paths::SUPPORT_DIR.join("node");let node_dir = node_containing_dir.join(folder_name);let node_binary = node_dir.join("bin/node");@@ -92,7 +99,7 @@ impl RealNodeRuntime {.await.context("error creating node containing dir")?;- let file_name = format!("node-{VERSION}-darwin-{arch}.tar.gz");+ let file_name = format!("node-{VERSION}-{os}-{arch}.tar.gz");let url = format!("https://nodejs.org/dist/{VERSION}/{file_name}");let mut response = self.httpdiff --git a/crates/zed/src/languages/clojure.rs b/crates/zed/src/languages/clojure.rsindex e200b9c6a0e..4362d2f3f1d 100644--- a/crates/zed/src/languages/clojure.rs+++ b/crates/zed/src/languages/clojure.rs@@ -33,12 +33,18 @@ impl super::LspAdapter for ClojureLspAdapter {delegate.http_client(),).await?;+ let os = match consts::OS {+ "macos" => "macos",+ "linux" => "linux",+ "windows" => "windows",+ other => bail!("Running on unsupported os: {other}"),+ };let platform = match consts::ARCH {"x86_64" => "amd64","aarch64" => "aarch64",other => bail!("Running on unsupported platform: {other}"),};- let asset_name = format!("clojure-lsp-native-macos-{platform}.zip");+ let asset_name = format!("clojure-lsp-native-{os}-{platform}.zip");let asset = release.assets.iter()diff --git a/crates/zed/src/languages/deno.rs b/crates/zed/src/languages/deno.rsindex a06c6e42d5f..3e7b8754e11 100644--- a/crates/zed/src/languages/deno.rs+++ b/crates/zed/src/languages/deno.rs@@ -1,4 +1,4 @@-use anyhow::{anyhow, Context, Result};+use anyhow::{anyhow, bail, Context, Result};use async_trait::async_trait;use collections::HashMap;use futures::StreamExt;@@ -72,7 +72,13 @@ impl LspAdapter for DenoLspAdapter {) -> Result<Box<dyn 'static + Send + Any>> {let release =latest_github_release("denoland/deno", true, false, delegate.http_client()).await?;- let asset_name = format!("deno-{}-apple-darwin.zip", consts::ARCH);+ let os = match consts::OS {+ "macos" => "apple-darwin",+ "linux" => "unknown-linux-gnu",+ "windows" => "pc-windows-msvc",+ other => bail!("Running on unsupported os: {other}"),+ };+ let asset_name = format!("deno-{}-{os}.zip", consts::ARCH);let asset = release.assets.iter()diff --git a/crates/zed/src/languages/gleam.rs b/crates/zed/src/languages/gleam.rsindex 508956b0994..2ff959655cf 100644--- a/crates/zed/src/languages/gleam.rs+++ b/crates/zed/src/languages/gleam.rs@@ -1,8 +1,9 @@use std::any::Any;+use std::env::consts;use std::ffi::OsString;use std::path::PathBuf;-use anyhow::{anyhow, Result};+use anyhow::{anyhow, bail, Result};use async_compression::futures::bufread::GzipDecoder;use async_tar::Archive;use async_trait::async_trait;@@ -36,11 +37,16 @@ impl LspAdapter for GleamLspAdapter {) -> Result<Box<dyn 'static + Send + Any>> {let release =latest_github_release("gleam-lang/gleam", true, false, delegate.http_client()).await?;-let asset_name = format!(- "gleam-{version}-{arch}-apple-darwin.tar.gz",+ "gleam-{version}-{arch}-{os}.tar.gz",version = release.tag_name,- arch = std::env::consts::ARCH+ arch = std::env::consts::ARCH,+ os = match consts::OS {+ "macos" => "apple-darwin",+ "linux" => "unknown-linux-musl",+ "windows" => "pc-windows-msvc",+ other => bail!("Running on unsupported os: {other}"),+ },);let asset = release.assetsdiff --git a/crates/zed/src/languages/lua.rs b/crates/zed/src/languages/lua.rsindex 7476ab37ea0..24cbafb50f7 100644--- a/crates/zed/src/languages/lua.rs+++ b/crates/zed/src/languages/lua.rs@@ -30,6 +30,12 @@ impl super::LspAdapter for LuaLspAdapter {&self,delegate: &dyn LspAdapterDelegate,) -> Result<Box<dyn 'static + Send + Any>> {+ let os = match consts::OS {+ "macos" => "darwin",+ "linux" => "linux",+ "windows" => "win32",+ other => bail!("Running on unsupported os: {other}"),+ };let platform = match consts::ARCH {"x86_64" => "x64","aarch64" => "arm64",@@ -43,7 +49,7 @@ impl super::LspAdapter for LuaLspAdapter {).await?;let version = &release.tag_name;- let asset_name = format!("lua-language-server-{version}-darwin-{platform}.tar.gz");+ let asset_name = format!("lua-language-server-{version}-{os}-{platform}.tar.gz");let asset = release.assets.iter()diff --git a/crates/zed/src/languages/rust.rs b/crates/zed/src/languages/rust.rsindex 7a95e26d9bd..8bcda939497 100644--- a/crates/zed/src/languages/rust.rs+++ b/crates/zed/src/languages/rust.rs@@ -1,4 +1,4 @@-use anyhow::{anyhow, Result};+use anyhow::{anyhow, bail, Result};use async_compression::futures::bufread::GzipDecoder;use async_trait::async_trait;use futures::{io::BufReader, StreamExt};@@ -38,7 +38,13 @@ impl LspAdapter for RustLspAdapter {delegate.http_client(),).await?;- let asset_name = format!("rust-analyzer-{}-apple-darwin.gz", consts::ARCH);+ let os = match consts::OS {+ "macos" => "apple-darwin",+ "linux" => "unknown-linux-gnu",+ "windows" => "pc-windows-msvc",+ other => bail!("Running on unsupported os: {other}"),+ };+ let asset_name = format!("rust-analyzer-{}-{os}.gz", consts::ARCH);let asset = release.assets.iter()diff --git a/crates/zed/src/languages/toml.rs b/crates/zed/src/languages/toml.rsindex 9393fa691e8..e6f933d707a 100644--- a/crates/zed/src/languages/toml.rs+++ b/crates/zed/src/languages/toml.rs@@ -1,4 +1,4 @@-use anyhow::{Context, Result};+use anyhow::{bail, Context, Result};use async_compression::futures::bufread::GzipDecoder;use async_trait::async_trait;use futures::{io::BufReader, StreamExt};@@ -28,7 +28,16 @@ impl LspAdapter for TaploLspAdapter {) -> Result<Box<dyn 'static + Send + Any>> {let release =latest_github_release("tamasfe/taplo", true, false, delegate.http_client()).await?;- let asset_name = format!("taplo-full-darwin-{arch}.gz", arch = std::env::consts::ARCH);+ let asset_name = format!(+ "taplo-full-{os}-{arch}.gz",+ os = match std::env::consts::OS {+ "macos" => "darwin",+ "linux" => "linux",+ "windows" => "windows",+ other => bail!("Running on unsupported os: {other}"),+ },+ arch = std::env::consts::ARCH+ );let asset = release.assetsdiff --git a/crates/zed/src/languages/zig.rs b/crates/zed/src/languages/zig.rsindex 12268c2e145..6c12f129c51 100644--- a/crates/zed/src/languages/zig.rs+++ b/crates/zed/src/languages/zig.rs@@ -6,7 +6,7 @@ use futures::{io::BufReader, StreamExt};use language::{LanguageServerName, LspAdapter, LspAdapterDelegate};use lsp::LanguageServerBinary;use smol::fs;-use std::env::consts::ARCH;+use std::env::consts::{ARCH, OS};use std::{any::Any, path::PathBuf};use util::async_maybe;use util::github::latest_github_release;@@ -30,7 +30,7 @@ impl LspAdapter for ZlsAdapter {) -> Result<Box<dyn 'static + Send + Any>> {let release =latest_github_release("zigtools/zls", true, false, delegate.http_client()).await?;- let asset_name = format!("zls-{ARCH}-macos.tar.gz");+ let asset_name = format!("zls-{ARCH}-{OS}.tar.gz");let asset = release.assets.iter()