mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-31 06:50:10 +00:00
zig: Unpin Zig LSP grab newest version off GH releases, and download from zigtools.org (#16645)
Fixed Zig LSP being pinned to 0.11.0 due to discontinuation of `.tar.gz` Release Notes: - N/A
This commit is contained in:
parent
5250866c1a
commit
bb725d3158
1 changed files with 29 additions and 28 deletions
|
@ -61,39 +61,40 @@ impl ZigExtension {
|
||||||
&language_server_id,
|
&language_server_id,
|
||||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||||
);
|
);
|
||||||
// We're pinning ZLS to a release that has `.tar.gz` assets, since the latest release does not have
|
|
||||||
// them, at time of writing.
|
|
||||||
//
|
|
||||||
// ZLS tracking issue: https://github.com/zigtools/zls/issues/1879
|
|
||||||
let release = zed::github_release_by_tag_name("zigtools/zls", "0.11.0")?;
|
|
||||||
|
|
||||||
let asset_name = format!(
|
// Note that in github releases and on zlstools.org the tar.gz asset is not shown
|
||||||
"zls-{arch}-{os}.{extension}",
|
// but is available at https://builds.zigtools.org/zls-{os}-{arch}-{version}.tar.gz
|
||||||
arch = match arch {
|
let release = zed::latest_github_release(
|
||||||
zed::Architecture::Aarch64 => "aarch64",
|
"zigtools/zls",
|
||||||
zed::Architecture::X86 => "x86",
|
zed::GithubReleaseOptions {
|
||||||
zed::Architecture::X8664 => "x86_64",
|
require_assets: true,
|
||||||
|
pre_release: false,
|
||||||
},
|
},
|
||||||
os = match platform {
|
)?;
|
||||||
zed::Os::Mac => "macos",
|
|
||||||
zed::Os::Linux => "linux",
|
|
||||||
zed::Os::Windows => "windows",
|
|
||||||
},
|
|
||||||
extension = match platform {
|
|
||||||
zed::Os::Mac | zed::Os::Linux => "tar.gz",
|
|
||||||
zed::Os::Windows => "zip",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
let asset = release
|
let arch: &str = match arch {
|
||||||
.assets
|
zed::Architecture::Aarch64 => "aarch64",
|
||||||
.iter()
|
zed::Architecture::X86 => "x86",
|
||||||
.find(|asset| asset.name == asset_name)
|
zed::Architecture::X8664 => "x86_64",
|
||||||
.ok_or_else(|| format!("no asset found matching {:?}", asset_name))?;
|
};
|
||||||
|
|
||||||
|
let os: &str = match platform {
|
||||||
|
zed::Os::Mac => "macos",
|
||||||
|
zed::Os::Linux => "linux",
|
||||||
|
zed::Os::Windows => "windows",
|
||||||
|
};
|
||||||
|
|
||||||
|
let extension: &str = match platform {
|
||||||
|
zed::Os::Mac | zed::Os::Linux => "tar.gz",
|
||||||
|
zed::Os::Windows => "zip",
|
||||||
|
};
|
||||||
|
|
||||||
|
let asset_name: String = format!("zls-{}-{}-{}.{}", os, arch, release.version, extension);
|
||||||
|
let download_url = format!("https://builds.zigtools.org/{}", asset_name);
|
||||||
|
|
||||||
let version_dir = format!("zls-{}", release.version);
|
let version_dir = format!("zls-{}", release.version);
|
||||||
let binary_path = match platform {
|
let binary_path = match platform {
|
||||||
zed::Os::Mac | zed::Os::Linux => format!("{version_dir}/bin/zls"),
|
zed::Os::Mac | zed::Os::Linux => format!("{version_dir}/zls"),
|
||||||
zed::Os::Windows => format!("{version_dir}/zls.exe"),
|
zed::Os::Windows => format!("{version_dir}/zls.exe"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -104,7 +105,7 @@ impl ZigExtension {
|
||||||
);
|
);
|
||||||
|
|
||||||
zed::download_file(
|
zed::download_file(
|
||||||
&asset.download_url,
|
&download_url,
|
||||||
&version_dir,
|
&version_dir,
|
||||||
match platform {
|
match platform {
|
||||||
zed::Os::Mac | zed::Os::Linux => zed::DownloadedFileType::GzipTar,
|
zed::Os::Mac | zed::Os::Linux => zed::DownloadedFileType::GzipTar,
|
||||||
|
|
Loading…
Reference in a new issue