refactor(lsp): suffix advice & remove redundancy
- Advice functions ought to have a -a suffix. - `eglot-send-changes-idle-time` is already 0.5 upstream, by default.
This commit is contained in:
parent
d22fa5a670
commit
367b671134
1 changed files with 3 additions and 4 deletions
|
@ -4,7 +4,7 @@
|
||||||
:commands eglot eglot-ensure
|
:commands eglot eglot-ensure
|
||||||
:hook (eglot-managed-mode . +lsp-optimization-mode)
|
:hook (eglot-managed-mode . +lsp-optimization-mode)
|
||||||
:init
|
:init
|
||||||
(defadvice! +eglot--ensure-available-mode (fn)
|
(defadvice! +eglot--ensure-available-mode-a (fn)
|
||||||
"Run `eglot-ensure' if the current mode has support."
|
"Run `eglot-ensure' if the current mode has support."
|
||||||
:around #'eglot-ensure
|
:around #'eglot-ensure
|
||||||
(when (alist-get major-mode eglot-server-programs nil nil
|
(when (alist-get major-mode eglot-server-programs nil nil
|
||||||
|
@ -15,7 +15,6 @@
|
||||||
(funcall fn)))
|
(funcall fn)))
|
||||||
(setq eglot-sync-connect 1
|
(setq eglot-sync-connect 1
|
||||||
eglot-autoshutdown t
|
eglot-autoshutdown t
|
||||||
eglot-send-changes-idle-time 0.5
|
|
||||||
;; NOTE: We disable eglot-auto-display-help-buffer because :select t in
|
;; NOTE: We disable eglot-auto-display-help-buffer because :select t in
|
||||||
;; its popup rule causes eglot to steal focus too often.
|
;; its popup rule causes eglot to steal focus too often.
|
||||||
eglot-auto-display-help-buffer nil)
|
eglot-auto-display-help-buffer nil)
|
||||||
|
@ -44,8 +43,8 @@
|
||||||
(defadvice! +lsp--defer-server-shutdown-a (fn &optional server)
|
(defadvice! +lsp--defer-server-shutdown-a (fn &optional server)
|
||||||
"Defer server shutdown for a few seconds.
|
"Defer server shutdown for a few seconds.
|
||||||
This gives the user a chance to open other project files before the server is
|
This gives the user a chance to open other project files before the server is
|
||||||
auto-killed (which is a potentially expensive process). It also prevents the
|
auto-killed (which is a potentially expensive process). It also spares the
|
||||||
server getting expensively restarted when reverting buffers."
|
server an expensive restart when its buffer is reverted."
|
||||||
:around #'eglot--managed-mode
|
:around #'eglot--managed-mode
|
||||||
(letf! (defun eglot-shutdown (server)
|
(letf! (defun eglot-shutdown (server)
|
||||||
(if (or (null +lsp-defer-shutdown)
|
(if (or (null +lsp-defer-shutdown)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue