aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2026-01-09 19:25:04 +0000
committerJoão Távora2026-01-11 03:42:01 +0000
commit7e13073c3c1abe6975c997fa99c2d5c0c753de9a (patch)
tree72b1a49ba7b14f1da79cc0611fe60d9b362cf0d6
parent236647ab58e6d3dd0b092e753c54317ad9004f39 (diff)
downloademacs-7e13073c3c1abe6975c997fa99c2d5c0c753de9a.tar.gz
emacs-7e13073c3c1abe6975c997fa99c2d5c0c753de9a.zip
Eglot: don't notify server of in-disk changes for managed files
Not only is this notification strictly redundant for files managed by Eglot (since didSave, didClose and didChange are scrupulously sent), but it also confuses some serers which end up posting a bunch of useless textDocument/publishDiagnostics, for example.
-rw-r--r--lisp/progmodes/eglot.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 82610d093ad..6cc48beea5e 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2392,7 +2392,7 @@ the previous reports for TOKEN.")
2392 (when (and eglot-autoshutdown 2392 (when (and eglot-autoshutdown
2393 (null (eglot--managed-buffers server)) 2393 (null (eglot--managed-buffers server))
2394 ;; Don't shutdown if up again soon. 2394 ;; Don't shutdown if up again soon.
2395 (with-no-warnings (not revert-buffer-in-progress-p))) 2395 (not (eglot--revert-in-progress-p)))
2396 (eglot-shutdown server))))))) 2396 (eglot-shutdown server)))))))
2397 2397
2398(defun eglot--managed-mode-off () 2398(defun eglot--managed-mode-off ()
@@ -2427,6 +2427,9 @@ the previous reports for TOKEN.")
2427 (when eglot-semantic-tokens-mode 2427 (when eglot-semantic-tokens-mode
2428 (eglot-semantic-tokens-mode)))) 2428 (eglot-semantic-tokens-mode))))
2429 2429
2430(defun eglot--revert-in-progress-p ()
2431 (with-no-warnings revert-buffer-in-progress-p))
2432
2430(defun eglot--maybe-activate-editing-mode () 2433(defun eglot--maybe-activate-editing-mode ()
2431 "Maybe activate `eglot--managed-mode'. 2434 "Maybe activate `eglot--managed-mode'.
2432 2435
@@ -4546,6 +4549,7 @@ happens to be inside or matching the project root."
4546 (candidate (if dir (file-relative-name file dir) file))) 4549 (candidate (if dir (file-relative-name file dir) file)))
4547 (cond 4550 (cond
4548 ((and (memq action '(created changed deleted)) 4551 ((and (memq action '(created changed deleted))
4552 (not (eglot--find-buffer-visiting server file))
4549 (cl-loop for (compiled . kind) in globs 4553 (cl-loop for (compiled . kind) in globs
4550 thereis (and (> (logand kind action-bit) 0) 4554 thereis (and (> (logand kind action-bit) 0)
4551 (funcall compiled candidate)))) 4555 (funcall compiled candidate))))