fix(lsp): shutdown deferral for multiple LSP clients

If a buffer had multiple LSP servers active,
`+lsp-defer-server-shutdown-a` would only shut down the first. This
adjusts it to not only defer shutdown of all servers, but also ensures
`+lsp-optimization-mode` is only disabled when there are no lsp-mode
sessions left.

Fix: #5409
This commit is contained in:
Henrik Lissner
2025-07-13 19:26:22 +02:00
parent 9219fa7c08
commit d63a15eba7
2 changed files with 21 additions and 14 deletions

View File

@@ -21,10 +21,13 @@ killing and opening many LSP/eglot-powered buffers.")
:global t
:init-value nil
(if (not +lsp-optimization-mode)
(setq-default read-process-output-max +lsp--default-read-process-output-max
gcmh-high-cons-threshold +lsp--default-gcmh-high-cons-threshold
+lsp--optimization-init-p nil)
;; Only apply these settings once!
;; Only apply these settings once! A minor mode's body is triggered each
;; time it is called, even if it's already in the desired state.
(when +lsp--optimization-init-p
(setq-default read-process-output-max +lsp--default-read-process-output-max
gcmh-high-cons-threshold +lsp--default-gcmh-high-cons-threshold
+lsp--optimization-init-p nil))
;; See above.
(unless +lsp--optimization-init-p
(setq +lsp--default-read-process-output-max (default-value 'read-process-output-max)
+lsp--default-gcmh-high-cons-threshold (default-value 'gcmh-high-cons-threshold))