mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-27 23:59:52 +03:00
Download right language server binary for OS (#8040)
Release Notes: - Download right language server binary for OS
This commit is contained in:
parent
3ef8a9910d
commit
4616d66e1d
@ -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
|
||||
.http
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
.assets
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
.assets
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user