fix(lsp): force lsp-zig-download-url-format to change
Can't change the variable after lsp-zig loads because its used when it's loaded. Can't set it before lsp-zig loads because it's a constant (resetting its value). Thank god it uses a (non-inlined) function to build that URL, so we have an easy target to advise. Fix: #7970 Amend:93dfb0acfb
Amend:bc5a8ec3fa
Amend:7bb5df4cd4
This commit is contained in:
parent
93dfb0acfb
commit
85b7b6151b
1 changed files with 13 additions and 2 deletions
|
@ -43,9 +43,20 @@ Can be a list of backends; accepts any value `company-backends' accepts.")
|
||||||
(when (modulep! :config default +bindings)
|
(when (modulep! :config default +bindings)
|
||||||
(setq lsp-keymap-prefix nil))
|
(setq lsp-keymap-prefix nil))
|
||||||
|
|
||||||
;; REVIEW: Remove when zigtools/zls#1879 is resolved.
|
|
||||||
(unless (featurep :system 'windows)
|
(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
|
:config
|
||||||
(add-to-list 'doom-debug-variables 'lsp-log-io)
|
(add-to-list 'doom-debug-variables 'lsp-log-io)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue