From 1882ce48be02ec68430683a29436ca618dd629a4 Mon Sep 17 00:00:00 2001 From: Julia Date: Mon, 26 Jun 2023 10:18:30 -0400 Subject: [PATCH] Handle new elixir-ls release zip name --- crates/zed/src/languages/elixir.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/crates/zed/src/languages/elixir.rs b/crates/zed/src/languages/elixir.rs index 22aaedc069..d07faae0cd 100644 --- a/crates/zed/src/languages/elixir.rs +++ b/crates/zed/src/languages/elixir.rs @@ -62,16 +62,23 @@ impl LspAdapter for ElixirLspAdapter { &self, delegate: &dyn LspAdapterDelegate, ) -> Result> { - let release = - latest_github_release("elixir-lsp/elixir-ls", false, delegate.http_client()).await?; - let asset_name = "elixir-ls.zip"; + let http = delegate.http_client(); + let release = latest_github_release("elixir-lsp/elixir-ls", false, http).await?; + let version_name = release + .name + .strip_prefix("Release ") + .context("Elixir-ls release name does not start with prefix")? + .to_owned(); + + let asset_name = format!("elixir-ls-{}.zip", &version_name); let asset = release .assets .iter() .find(|asset| asset.name == asset_name) .ok_or_else(|| anyhow!("no asset found matching {:?}", asset_name))?; + let version = GitHubLspBinaryVersion { - name: release.name, + name: version_name, url: asset.browser_download_url.clone(), }; Ok(Box::new(version) as Box<_>) @@ -116,7 +123,7 @@ impl LspAdapter for ElixirLspAdapter { .await? .status; if !unzip_status.success() { - Err(anyhow!("failed to unzip clangd archive"))?; + Err(anyhow!("failed to unzip elixir-ls archive"))?; } remove_matching(&container_dir, |entry| entry != version_dir).await;