diff --git a/modules/tools/lsp/packages.el b/modules/tools/lsp/packages.el index c57dc0689..9dc4998f1 100644 --- a/modules/tools/lsp/packages.el +++ b/modules/tools/lsp/packages.el @@ -13,23 +13,13 @@ :recipe (:host github :repo "jdtsmith/eglot-booster") :pin "cab7803c4f0adc7fff9da6680f90110674bb7a22"))) - ;; HACK: Ensure lsp-mode is built with lsp-use-plists on, but also that - ;; `lsp-use-plists' isn't set *before* the package is rebuilt (which would - ;; break things). + ;; lsp-mode must be rebuilt if this variable is changed, so expose it here so + ;; users can change it from $DOOMDIR/packages.el. (defvar lsp-use-plists t) - (add-hook 'straight-use-package-pre-build-functions - (lambda (package) - (when (equal package "lsp-mode") - (let ((default-directory (doom-path doom-profile-dir doom-profile-init-dir-name)) - (gen-file "01-modules-lsp-use-plists.el")) - (if (not lsp-use-plists) - (when (file-exists-p gen-file) - (delete-file gen-file)) - (setenv "LSP_USE_PLISTS" "1") ; ensure the setting propagates to child processes - (add-to-list 'doom-profile-generators - (list gen-file (fn! `((setenv "LSP_USE_PLISTS" "1")))))))))) - (package! lsp-mode :pin "c74a723870f86cf9d1b7aee5e6e2add10d9ce127") + (package! lsp-mode + :pin "c74a723870f86cf9d1b7aee5e6e2add10d9ce127" + :env `(("LSP_USE_PLISTS" . ,(and lsp-use-plists "1")))) (package! lsp-ui :pin "030d36960338fd633a98b332bc3734c412c25ca6") (when (modulep! :completion ivy) (package! lsp-ivy :pin "2927cbc776477e23d4a1062568d55793eed33c51"))