mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-27 14:23:43 -05:00
refactor(lsp): eglot-booster: conform to conventions
Ref: #8463
Amend: 1ede94c88a
This commit is contained in:
@@ -164,20 +164,21 @@ server getting expensively restarted when reverting buffers."
|
||||
(add-hook 'lsp-mode-hook #'lsp-completion-mode))
|
||||
|
||||
(when (modulep! +booster)
|
||||
(defun lsp-booster--advice-final-command (old-fn cmd &optional test?)
|
||||
(defadvice! +lsp--booster-final-command-a (fn cmd &optional test?)
|
||||
"Prepend emacs-lsp-booster command to lsp CMD."
|
||||
(let ((orig-result (funcall old-fn cmd test?)))
|
||||
:around #'lsp-resolve-final-command
|
||||
(let ((orig-result (funcall fn cmd test?)))
|
||||
(if (and (not test?) ;; for check lsp-server-present?
|
||||
(not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
|
||||
(not (functionp 'json-rpc-connection)) ;; native json-rpc
|
||||
(executable-find "emacs-lsp-booster"))
|
||||
(progn
|
||||
(when-let ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH)
|
||||
(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)))
|
||||
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)))
|
||||
orig-result)))))
|
||||
|
||||
|
||||
(use-package! lsp-ui
|
||||
:hook (lsp-mode . lsp-ui-mode)
|
||||
|
Reference in New Issue
Block a user