aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2025-04-08 08:43:14 +0100
committerJoão Távora2025-04-08 08:46:17 +0100
commit13f439ce98c4cdd57bddfa671f071e31fa2badc6 (patch)
tree0d5480e4f5c38f2610b1d35569c7e6695af3aeba
parent577ddbb9b79c067d296d50f3e8a04c193c1632b3 (diff)
downloademacs-13f439ce98c4cdd57bddfa671f071e31fa2badc6.tar.gz
emacs-13f439ce98c4cdd57bddfa671f071e31fa2badc6.zip
Eglot: check textDocument/publishDiagnostics version (bug#77588)
* lisp/progmodes/eglot.el (eglot--versioned-identifier): Move up. (eglot-handle-notification textDocument/publishDiagnostics): Check eglot--versioned-identifier
-rw-r--r--lisp/progmodes/eglot.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index c937283122e..bfa67ebfff0 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2657,9 +2657,12 @@ Value is (TRUENAME . (:uri STR)), where STR is what is sent to the
2657server on textDocument/didOpen and similar calls. TRUENAME is the 2657server on textDocument/didOpen and similar calls. TRUENAME is the
2658expensive cached value of `file-truename'.") 2658expensive cached value of `file-truename'.")
2659 2659
2660(defvar-local eglot--versioned-identifier 0)
2661
2660(cl-defmethod eglot-handle-notification 2662(cl-defmethod eglot-handle-notification
2661 (server (_method (eql textDocument/publishDiagnostics)) &key uri diagnostics 2663 (server (_method (eql textDocument/publishDiagnostics))
2662 &allow-other-keys) ; FIXME: doesn't respect `eglot-strict-mode' 2664 &key uri diagnostics version
2665 &allow-other-keys) ; FIXME: doesn't respect `eglot-strict-mode'
2663 "Handle notification publishDiagnostics." 2666 "Handle notification publishDiagnostics."
2664 (cl-flet ((eglot--diag-type (sev) 2667 (cl-flet ((eglot--diag-type (sev)
2665 (cond ((null sev) 'eglot-error) 2668 (cond ((null sev) 'eglot-error)
@@ -2681,6 +2684,8 @@ expensive cached value of `file-truename'.")
2681 (with-current-buffer buffer 2684 (with-current-buffer buffer
2682 (cl-loop 2685 (cl-loop
2683 initially 2686 initially
2687 (if (and version (/= version eglot--versioned-identifier))
2688 (cl-return))
2684 (setq flymake-list-only-diagnostics 2689 (setq flymake-list-only-diagnostics
2685 (assoc-delete-all path flymake-list-only-diagnostics)) 2690 (assoc-delete-all path flymake-list-only-diagnostics))
2686 for diag-spec across diagnostics 2691 for diag-spec across diagnostics
@@ -2809,8 +2814,6 @@ Sets `eglot--TextDocumentIdentifier-cache' (which see) as a side effect."
2809 `(,truename . (:uri ,(eglot-path-to-uri truename :truenamep t)))))) 2814 `(,truename . (:uri ,(eglot-path-to-uri truename :truenamep t))))))
2810 (cdr eglot--TextDocumentIdentifier-cache)) 2815 (cdr eglot--TextDocumentIdentifier-cache))
2811 2816
2812(defvar-local eglot--versioned-identifier 0)
2813
2814(defun eglot--VersionedTextDocumentIdentifier () 2817(defun eglot--VersionedTextDocumentIdentifier ()
2815 "Compute VersionedTextDocumentIdentifier object for current buffer." 2818 "Compute VersionedTextDocumentIdentifier object for current buffer."
2816 (append (eglot--TextDocumentIdentifier) 2819 (append (eglot--TextDocumentIdentifier)