Skip to content

Commit 4cfc017

Browse files
authored
Fix use tar xz for zig (#5017)
* feat: explicitly support tar.xz files. * fix(clients): use tar.xz for zls download. As far as I can tell, the last zls that had a .tar.gz path was v0.11.0 released in August 2023. Switch to the correct .tar.xz path. We could just update that path, but we provide a custom to allow the old path to be used, and we explicitly support :tarxz as an option for :decompress to be explicit. This isn't strictly necessary, since the same `tar xz file` command will decompress .tar.gz and .tar.xz along with .tar.bz2 and .tar.zst, but we download to the correct intermediate path in order to reduce confusion.
1 parent 7a7a858 commit 4cfc017

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

clients/lsp-zig.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ If the value is `nil', it will use the latest version instead."
267267
arch "windows" ver "zip"))
268268
(darwin
269269
(format lsp-zig-download-url-format
270-
arch "macos" ver "tar.gz"))
270+
arch "macos" ver "tar.xz"))
271271
(gnu/linux
272272
(format lsp-zig-download-url-format
273-
arch "linux" ver "tar.gz")))))
273+
arch "linux" ver "tar.xz")))))
274274

275275
(defun lsp-zig--stored-zls-executable ()
276276
"Return the stored zls executable.
@@ -284,7 +284,7 @@ and not the global storage."
284284
'zls
285285
'(:system "zls")
286286
`(:download :url ,(lambda (&rest _) (lsp-zig--zls-url))
287-
:decompress ,(pcase system-type ('windows-nt :zip) (_ :targz))
287+
:decompress ,(pcase system-type ('windows-nt :zip) (_ :tarxz))
288288
:store-path ,(f-join lsp-zig-server-store-path "temp")
289289
:set-executable? t)
290290
`(:system ,(lsp-zig--stored-zls-executable)))

lsp-mode.el

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8684,8 +8684,9 @@ nil."
86848684
(:gzip (concat store-path ".gz"))
86858685
(:zip (concat store-path ".zip"))
86868686
(:targz (concat store-path ".tar.gz"))
8687+
(:tarxz (concat store-path ".tar.xz"))
86878688
(`nil store-path)
8688-
(_ (error ":decompress must be `:gzip', `:zip', `:targz' or `nil'")))))
8689+
(_ (error ":decompress must be `:gzip', `:zip', `:targz', `:tarxz' or `nil'")))))
86898690
(make-thread
86908691
(lambda ()
86918692
(condition-case err
@@ -8728,7 +8729,8 @@ nil."
87288729
(:gzip
87298730
(lsp-gunzip download-path))
87308731
(:zip (lsp-unzip download-path (f-parent store-path)))
8731-
(:targz (lsp-tar-gz-decompress download-path (f-parent store-path))))
8732+
(:targz (lsp-tar-gz-decompress download-path (f-parent store-path)))
8733+
(:tarxz (lsp-tar-gz-decompress download-path (f-parent store-path)))) ;; NOTE: this function decompresses all tar compressed paths.
87328734
(lsp--info "Decompressed %s..." store-path))
87338735
(funcall callback))
87348736
(error (funcall error-callback err)))))))

0 commit comments

Comments
 (0)