Fix gopls langserver downloads (#7571)

Fixes https://github.com/zed-industries/zed/issues/7534 by not requiring
assets for gopls and vscode-eslint langservers — those two are the only
ones in Zed that do not use assets directly when determining langserver
version and retrieving those.
All other servers deal with assets, hence require those to be present.

The problem with https://github.com/tamasfe/taplo/releases is that they
host multiple binary releases in the same release list, so for now the
code works because only the langserver has assets — but as soon as
another release there gets assets, it will break again.
We could filter out those by names also, but they also tend to change
(and can be edited manually), so keeping it as is for now.

Release Notes:

- Fixed gopls language server downloads
([7534](https://github.com/zed-industries/zed/issues/7534))
This commit is contained in:
Kirill Bulatov 2024-02-08 16:17:47 +02:00 committed by GitHub
parent f734365b7b
commit 89b1e76003
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 57 additions and 31 deletions

View file

@ -27,6 +27,7 @@ pub struct GithubReleaseAsset {
pub async fn latest_github_release(
repo_name_with_owner: &str,
require_assets: bool,
pre_release: bool,
http: Arc<dyn HttpClient>,
) -> Result<GithubRelease, anyhow::Error> {
@ -68,6 +69,7 @@ pub async fn latest_github_release(
releases
.into_iter()
.find(|release| !release.assets.is_empty() && release.pre_release == pre_release)
.filter(|release| !require_assets || !release.assets.is_empty())
.find(|release| release.pre_release == pre_release)
.ok_or(anyhow!("Failed to find a release"))
}