diff --git a/crates/languages/src/c.rs b/crates/languages/src/c.rs index 8fe2bae693d702346a1ecc96334d35b89d179b3b..76a0674edafd51110777346d8e95722dfd0cd4f9 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 { + 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 { + 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 {