]> git.eshelyaron.com Git - emacs.git/commitdiff
Properly clear old diagnostics when making new ones
authorMichal Krzywkowski <k.michal@zoho.com>
Mon, 3 Dec 2018 11:49:34 +0000 (12:49 +0100)
committerMichal Krzywkowski <k.michal@zoho.com>
Mon, 3 Dec 2018 12:00:41 +0000 (13:00 +0100)
* eglot.el (eglot-handle-notification
  textDocument/publishDiagnostics): Call flymake report function with
  :region.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/159

lisp/progmodes/eglot.el

index 2e99fc0cdd3be49fb9eefabe4c8d004b735b7a83..86db5ea322f07c486d287a1c1797fc492485a992 100644 (file)
@@ -1313,7 +1313,13 @@ COMMAND is a symbol naming the command."
                                        message `((eglot-lsp-diag . ,diag-spec)))))
          into diags
          finally (cond ((and flymake-mode eglot--current-flymake-report-fn)
-                        (funcall eglot--current-flymake-report-fn diags)
+                        (funcall eglot--current-flymake-report-fn diags
+                                 ;; If the buffer hasn't changed since last
+                                 ;; call to the report function, flymake won't
+                                 ;; delete old diagnostics.  Using :region
+                                 ;; keyword forces flymake to delete
+                                 ;; them (github#159).
+                                 :region (cons (point-min) (point-max)))
                         (setq eglot--unreported-diagnostics nil))
                        (t
                         (setq eglot--unreported-diagnostics (cons t diags))))))