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.

Fail early if clangd is downloaded on aarch Linux (#46346)

Kirill Bulatovf59986429423
diff --git a/crates/languages/src/c.rs b/crates/languages/src/c.rs
index 8fe2bae693d..76a0674edaf 100644
--- a/crates/languages/src/c.rs
+++ b/crates/languages/src/c.rs
@@ -27,6 +27,8 @@ impl LspInstaller for CLspAdapter {
pre_release: bool,
_: &mut AsyncApp,
) -> Result<GitHubLspBinaryVersion> {
+ ensure_arch_compatibility()?;
+
let release =
latest_github_release("clangd/clangd", true, pre_release, delegate.http_client())
.await?;
@@ -70,6 +72,8 @@ impl LspInstaller for CLspAdapter {
container_dir: PathBuf,
delegate: &dyn LspAdapterDelegate,
) -> Result<LanguageServerBinary> {
+ ensure_arch_compatibility()?;
+
let GitHubLspBinaryVersion {
name,
url,
@@ -147,6 +151,16 @@ impl LspInstaller for CLspAdapter {
}
}
+fn ensure_arch_compatibility() -> Result<()> {
+ let arch = consts::ARCH;
+ if consts::OS == "linux" && !["x86_64", "x86"].contains(&arch) {
+ anyhow::bail!(
+ "Clangd does not provide prebuilt binaries for {arch} to fetch from GitHub. Consider installing the binary manually."
+ )
+ }
+ Ok(())
+}
+
#[async_trait(?Send)]
impl super::LspAdapter for CLspAdapter {
fn name(&self) -> LanguageServerName {