branch: externals/eglot
commit 38da3d3b31ee19a5cea03951f5c535750858aaac
Author: Michał Krzywkowski <[email protected]>
Commit: Michał Krzywkowski <[email protected]>
Fix #159: Properly clear old diagnostics when making new ones
* eglot.el (eglot-handle-notification
textDocument/publishDiagnostics): Call flymake report function with
:region.
---
eglot.el | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/eglot.el b/eglot.el
index 2e99fc0..86db5ea 100644
--- a/eglot.el
+++ b/eglot.el
@@ -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))))))