Skip to content

Commit

Permalink
Respect lsp-deferred when activating lsp-mode (#4436)
Browse files Browse the repository at this point in the history
Don't call `(lsp)` if the buffer was loaded with `(lsp-deferred)`.
This fixes lsp-deferred to actually work since desktop mode
re-activates lsp-mode when restoring your desktop file.

Co-authored-by: Muir Manders <[email protected]>
  • Loading branch information
muirdm and Muir Manders authored Apr 22, 2024
1 parent 0f3c340 commit f2b9ab5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,9 @@ called with nil the signature info must be cleared."
(defvar-local lsp--buffer-workspaces ()
"List of the buffer workspaces.")

(defvar-local lsp--buffer-deferred nil
"Whether buffer was loaded via `lsp-deferred'.")

(defvar lsp--session nil
"Contain the `lsp-session' for the current Emacs instance.")

Expand Down Expand Up @@ -2931,7 +2934,7 @@ and end-of-string meta-characters."
(:propertize "Disconnected" face warning))
"]")
:group 'lsp-mode
(when (and lsp-mode (not lsp--buffer-workspaces))
(when (and lsp-mode (not lsp--buffer-workspaces) (not lsp--buffer-deferred))
;; fire up `lsp' when someone calls `lsp-mode' instead of `lsp'
(lsp)))

Expand Down Expand Up @@ -7635,9 +7638,6 @@ should return the command to start the LS server."
;; yas-snippet config
(setq-local yas-inhibit-overlay-modification-protection t))

(defvar-local lsp--buffer-deferred nil
"Whether buffer was loaded via `lsp-deferred'.")

(defun lsp--restart-if-needed (workspace)
"Handler restart for WORKSPACE."
(when (or (eq lsp-restart 'auto-restart)
Expand Down

0 comments on commit f2b9ab5

Please sign in to comment.