diff --git a/modules/tools/lsp/+lsp.el b/modules/tools/lsp/+lsp.el index 3fbcebc6d..95abfd247 100644 --- a/modules/tools/lsp/+lsp.el +++ b/modules/tools/lsp/+lsp.el @@ -43,9 +43,20 @@ Can be a list of backends; accepts any value `company-backends' accepts.") (when (modulep! :config default +bindings) (setq lsp-keymap-prefix nil)) - ;; REVIEW: Remove when zigtools/zls#1879 is resolved. (unless (featurep :system 'windows) - (setq lsp-zig-download-url-format "https://github.com/zigtools/zls/releases/latest/download/zls-%s-%s.tar.xz")) + ;; HACK: Frustratingly enough, the value of `lsp-zig-download-url-format' is + ;; used immediately while the lsp-zig package is loading, so changing it + ;; *after* lsp-zig makes no difference. What's worse, the variable is a + ;; constant, so we can't change it *before* the package is loaded either! + ;; Thank god a (non-inlined) function is used to build the URL, so we have + ;; something to advise. + ;; REVIEW: Remove when zigtools/zls#1879 is resolved. + (defadvice! +lsp--use-correct-zls-download-url-a (fn &rest _) + "See zigtools/zls#1879." + :around #'lsp-zig--zls-url + (let ((lsp-zig-download-url-format + "https://github.com/zigtools/zls/releases/latest/download/zls-%s-%s.tar.xz")) + (apply fn args)))) :config (add-to-list 'doom-debug-variables 'lsp-log-io)