diff options
| author | João Távora | 2022-12-07 11:30:34 +0000 |
|---|---|---|
| committer | João Távora | 2022-12-07 11:30:45 +0000 |
| commit | bfc00f1c12047ff431eaa9da3a744807c3f9e6e2 (patch) | |
| tree | 5957e96690d67db53b8acbaad19f9aa02d16c30b | |
| parent | d2411615e8bcfb2536f0a0da87869d751eee7892 (diff) | |
| download | emacs-bfc00f1c12047ff431eaa9da3a744807c3f9e6e2.tar.gz emacs-bfc00f1c12047ff431eaa9da3a744807c3f9e6e2.zip | |
Eglot: fix setting of flymake-list-only-diagnostics (bug#59824)
When Eglot receives diagnostics for a file not yet visited in Emacs,
it stores them in flymake-list-only-diagnostics, which feed M-x
flymake-show-project-diagnostics. If the file is eventually visited
in a buffer and Eglot starts receibing diagnostics for it, the
flymake-list-only-diagnostics database has to be updated accordingly,
since the previous diagnostics are now stale.
* lisp/progmodes/eglot.el (eglot-handle-notification): Reset
flymake-list-only-diagnostics
| -rw-r--r-- | lisp/progmodes/eglot.el | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index c266f6e18a3..363ca004e47 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el | |||
| @@ -2060,9 +2060,11 @@ COMMAND is a symbol naming the command." | |||
| 2060 | (t 'eglot-note))) | 2060 | (t 'eglot-note))) |
| 2061 | (mess (source code message) | 2061 | (mess (source code message) |
| 2062 | (concat source (and code (format " [%s]" code)) ": " message))) | 2062 | (concat source (and code (format " [%s]" code)) ": " message))) |
| 2063 | (if-let ((buffer (find-buffer-visiting (eglot--uri-to-path uri)))) | 2063 | (if-let* ((path (expand-file-name (eglot--uri-to-path uri))) |
| 2064 | (buffer (find-buffer-visiting path))) | ||
| 2064 | (with-current-buffer buffer | 2065 | (with-current-buffer buffer |
| 2065 | (cl-loop | 2066 | (cl-loop |
| 2067 | initially (assoc-delete-all path flymake-list-only-diagnostics #'string=) | ||
| 2066 | for diag-spec across diagnostics | 2068 | for diag-spec across diagnostics |
| 2067 | collect (eglot--dbind ((Diagnostic) range code message severity source tags) | 2069 | collect (eglot--dbind ((Diagnostic) range code message severity source tags) |
| 2068 | diag-spec | 2070 | diag-spec |
| @@ -2105,7 +2107,6 @@ COMMAND is a symbol naming the command." | |||
| 2105 | (t | 2107 | (t |
| 2106 | (setq eglot--diagnostics diags))))) | 2108 | (setq eglot--diagnostics diags))))) |
| 2107 | (cl-loop | 2109 | (cl-loop |
| 2108 | with path = (expand-file-name (eglot--uri-to-path uri)) | ||
| 2109 | for diag-spec across diagnostics | 2110 | for diag-spec across diagnostics |
| 2110 | collect (eglot--dbind ((Diagnostic) code range message severity source) diag-spec | 2111 | collect (eglot--dbind ((Diagnostic) code range message severity source) diag-spec |
| 2111 | (setq message (mess source code message)) | 2112 | (setq message (mess source code message)) |