Skip to content

Commit d2d58d8

Browse files
committed
Add custom desktop minor mode handler for lsp-deferred
Use lsp-deferred instead of lsp-mode even in the case that lsp-mode appears in the list of minor modes for a file in a user's desktop file by adding the buffer-local variable lsp--buffer-deferred (which tracks whether a given buffer was started using lsp-deferred) to the variable desktop-locals-to-save so that it is persisted in a user's desktop file, and adding a custom handler to desktop-minor-mode-handlers which uses this persisted variable to determine whether to use lsp-deferred of lsp-mode when re-opening a file from the desktop file.
1 parent b45dea4 commit d2d58d8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lsp-mode.el

+8
Original file line numberDiff line numberDiff line change
@@ -9124,6 +9124,14 @@ This avoids overloading the server with many files when starting Emacs."
91249124
(unless (lsp--init-if-visible)
91259125
(add-hook 'window-configuration-change-hook #'lsp--init-if-visible nil t))))))))
91269126

9127+
(with-eval-after-load 'desktop
9128+
(add-to-list 'desktop-locals-to-save 'lsp--buffer-deferred)
9129+
(add-to-list 'desktop-minor-mode-handlers
9130+
'(lsp-mode . (lambda (desktop-buffer-locals)
9131+
(if (alist-get 'lsp--buffer-deferred desktop-buffer-locals)
9132+
(lsp-deferred)
9133+
(lsp-mode))))))
9134+
91279135

91289136

91299137
(defvar lsp-file-truename-cache (ht))

0 commit comments

Comments
 (0)