fix(lsp): disable lsp-mode + emacs-lsp-booster advice

This is temporary until a better solution is found.

This advice does nothing for lsp-mode without the accompanying
`jsonrpc--json-read` advice eglot-booster uses. Needs more testing to
make sure it's worth the trouble on Emacs 30+ and is compatible with
`lsp-use-plists`.

Ref: #8463
Amend: 1ede94c88a
This commit is contained in:
Henrik Lissner
2025-08-21 16:29:35 +02:00
parent c7d5ad622e
commit 79c8621091

View File

@@ -163,21 +163,26 @@ server getting expensively restarted when reverting buffers."
(setq lsp-completion-provider :none) (setq lsp-completion-provider :none)
(add-hook 'lsp-mode-hook #'lsp-completion-mode)) (add-hook 'lsp-mode-hook #'lsp-completion-mode))
(when (modulep! +booster) ;; TODO: Without eglot-booster's `jsonrpc--json-read' advice, this advice is
(defadvice! +lsp--booster-final-command-a (fn cmd &optional test?) ;; counter-productive. And it's questionable whether the marginal gains from
"Prepend emacs-lsp-booster command to lsp CMD." ;; IO buffering beyond Emacs 30+ are worth the trouble. Also needs to be
:around #'lsp-resolve-final-command ;; tested with `lsp-use-plists'.
(let ((orig-result (funcall fn cmd test?))) ;; (when (modulep! +booster)
(if (and (not test?) ;; for check lsp-server-present? ;; (defadvice! +lsp--booster-final-command-a (fn cmd &optional test?)
(not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper ;; "Prepend emacs-lsp-booster command to lsp CMD."
(not (functionp 'json-rpc-connection)) ;; native json-rpc ;; :around #'lsp-resolve-final-command
(executable-find "emacs-lsp-booster")) ;; (let ((orig-result (funcall fn cmd test?)))
(progn ;; (if (and (not test?) ;; for check lsp-server-present?
(when-let* ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH) ;; (not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
(setcar orig-result command-from-exec-path)) ;; (not (functionp 'json-rpc-connection)) ;; native json-rpc
(message "Using emacs-lsp-booster for %s!" orig-result) ;; (executable-find "emacs-lsp-booster"))
(append '("emacs-lsp-booster" "--disable-bytecode" "--") orig-result)) ;; (progn
orig-result))))) ;; (when-let* ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH)
;; (setcar orig-result command-from-exec-path))
;; (message "Using emacs-lsp-booster for %s!" orig-result)
;; (append '("emacs-lsp-booster" "--disable-bytecode" "--") orig-result))
;; orig-result))))
)
(use-package! lsp-ui (use-package! lsp-ui