From beee79a9e768e65a17b494ed5bbf59a00edcdb41 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Fri, 3 May 2024 23:11:46 +0800 Subject: [PATCH] toml: Fix language server installation on Windows (#11251) Release Notes: - N/A --- Follow #11156, to make sure extensions install on window. https://github.com/tamasfe/taplo/releases/tag/0.8.1 The Taplo have `gz` for windows, so we can just use `gz`. --------- Co-authored-by: Marshall Bowers --- extensions/toml/src/toml.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/extensions/toml/src/toml.rs b/extensions/toml/src/toml.rs index 2c355121f2..b821bca135 100644 --- a/extensions/toml/src/toml.rs +++ b/extensions/toml/src/toml.rs @@ -31,7 +31,7 @@ impl TomlExtension { let (platform, arch) = zed::current_platform(); let asset_name = format!( - "taplo-full-{os}-{arch}.{extension}", + "taplo-full-{os}-{arch}.gz", arch = match arch { zed::Architecture::Aarch64 => "aarch64", zed::Architecture::X86 => "x86", @@ -42,10 +42,6 @@ impl TomlExtension { zed::Os::Linux => "linux", zed::Os::Windows => "windows", }, - extension = match platform { - zed::Os::Mac | zed::Os::Linux => "gz", - zed::Os::Windows => "zip", - } ); let asset = release @@ -58,7 +54,13 @@ impl TomlExtension { fs::create_dir_all(&version_dir) .map_err(|err| format!("failed to create directory '{version_dir}': {err}"))?; - let binary_path = format!("{version_dir}/taplo"); + let binary_path = format!( + "{version_dir}/{bin_name}", + bin_name = match platform { + zed::Os::Windows => "taplo.exe", + zed::Os::Mac | zed::Os::Linux => "taplo", + } + ); if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) { zed::set_language_server_installation_status( @@ -69,10 +71,7 @@ impl TomlExtension { zed::download_file( &asset.download_url, &binary_path, - match platform { - zed::Os::Mac | zed::Os::Linux => zed::DownloadedFileType::Gzip, - zed::Os::Windows => zed::DownloadedFileType::Zip, - }, + zed::DownloadedFileType::Gzip, ) .map_err(|err| format!("failed to download file: {err}"))?;