Skip to content

Commit 9eb043f

Browse files
Use run-with-idle-timer for lsp-deferred (#3034)
`run-with-timer` triggers immediately after the buffer is visible. But the environment is not set for the remote files at the time when LSP binary is looked up. This results in `matching-clients` to be nil. Changing it to `run-with-idle-timer` ensures the buffer is done with loading remote file and setting the environment and runs immediately after the file is loaded in the buffer.
1 parent d1af589 commit 9eb043f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lsp-mode.el

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8325,11 +8325,11 @@ This avoids overloading the server with many files when starting Emacs."
83258325
(let ((buffer (current-buffer)))
83268326
;; Avoid false positives as desktop-mode restores buffers by deferring
83278327
;; visibility check until the stack clears.
8328-
(run-with-timer 0 nil (lambda ()
8329-
(when (buffer-live-p buffer)
8330-
(with-current-buffer buffer
8331-
(unless (lsp--init-if-visible)
8332-
(add-hook 'window-configuration-change-hook #'lsp--init-if-visible nil t))))))))
8328+
(run-with-idle-timer 0 nil (lambda ()
8329+
(when (buffer-live-p buffer)
8330+
(with-current-buffer buffer
8331+
(unless (lsp--init-if-visible)
8332+
(add-hook 'window-configuration-change-hook #'lsp--init-if-visible nil t))))))))
83338333

83348334

83358335

0 commit comments

Comments
 (0)