mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-25 14:13:37 -05:00
refactor(lsp): eglot-booster: conform to conventions
Ref: #8463
Amend: 1ede94c88a
This commit is contained in:
@@ -55,6 +55,15 @@ server an expensive restart when its buffer is reverted."
|
|||||||
(funcall fn server))))
|
(funcall fn server))))
|
||||||
|
|
||||||
|
|
||||||
|
(use-package! eglot-booster
|
||||||
|
:when (modulep! +booster)
|
||||||
|
:after eglot
|
||||||
|
:init
|
||||||
|
(setq eglot-booster-io-only t)
|
||||||
|
:config
|
||||||
|
(eglot-booster-mode +1))
|
||||||
|
|
||||||
|
|
||||||
(use-package! consult-eglot
|
(use-package! consult-eglot
|
||||||
:when (modulep! :completion vertico)
|
:when (modulep! :completion vertico)
|
||||||
:defer t
|
:defer t
|
||||||
@@ -67,10 +76,3 @@ server an expensive restart when its buffer is reverted."
|
|||||||
(use-package! flycheck-eglot
|
(use-package! flycheck-eglot
|
||||||
:when (modulep! :checkers syntax -flymake)
|
:when (modulep! :checkers syntax -flymake)
|
||||||
:hook (eglot-managed-mode . flycheck-eglot-mode))
|
:hook (eglot-managed-mode . flycheck-eglot-mode))
|
||||||
|
|
||||||
(use-package! eglot-booster
|
|
||||||
:when (modulep! +eglot +booster)
|
|
||||||
:after eglot
|
|
||||||
:config (eglot-booster-mode)
|
|
||||||
:init
|
|
||||||
(setq eglot-booster-io-only t))
|
|
||||||
|
@@ -164,20 +164,21 @@ server getting expensively restarted when reverting buffers."
|
|||||||
(add-hook 'lsp-mode-hook #'lsp-completion-mode))
|
(add-hook 'lsp-mode-hook #'lsp-completion-mode))
|
||||||
|
|
||||||
(when (modulep! +booster)
|
(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."
|
"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?
|
(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 (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
|
||||||
(not (functionp 'json-rpc-connection)) ;; native json-rpc
|
(not (functionp 'json-rpc-connection)) ;; native json-rpc
|
||||||
(executable-find "emacs-lsp-booster"))
|
(executable-find "emacs-lsp-booster"))
|
||||||
(progn
|
(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))
|
(setcar orig-result command-from-exec-path))
|
||||||
(message "Using emacs-lsp-booster for %s!" orig-result)
|
(message "Using emacs-lsp-booster for %s!" orig-result)
|
||||||
(append '("emacs-lsp-booster" "--disable-bytecode" "--") orig-result))
|
(append '("emacs-lsp-booster" "--disable-bytecode" "--") orig-result))
|
||||||
orig-result)))
|
orig-result)))))
|
||||||
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)))
|
|
||||||
|
|
||||||
(use-package! lsp-ui
|
(use-package! lsp-ui
|
||||||
:hook (lsp-mode . lsp-ui-mode)
|
:hook (lsp-mode . lsp-ui-mode)
|
||||||
|
Reference in New Issue
Block a user