branch: externals/elpa
commit 22dc2f7ba341b66bc904afa0ffa75b7da86a413e
Author: João Távora <joaotav...@gmail.com>
Commit: João Távora <joaotav...@gmail.com>

    Ready to start fixing flymake integration
    
    * eglot.el (eglot-editing-mode): Turn on flymake-mode.
    (eglot-flymake-backend): Always start by reporting no diagnostics.
    (eglot--textDocument/publishDiagnostics): No annoying message.
---
 eglot.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/eglot.el b/eglot.el
index d3428a7..aa23252 100644
--- a/eglot.el
+++ b/eglot.el
@@ -573,7 +573,6 @@ running.  INTERACTIVE is t if called interactively."
       (eglot--warn "outdated publishDiagnostics report from server"))
      (buffer
       (with-current-buffer buffer
-        (eglot--message "OK so add some %s diags" (length diagnostics))
         (cl-flet ((pos-at
                    (pos-plist)
                    (car (flymake-diag-region
@@ -662,6 +661,7 @@ running.  INTERACTIVE is t if called interactively."
     (eglot-mode 1)
     (add-hook 'after-change-functions 'eglot--after-change nil t)
     (add-hook 'flymake-diagnostic-functions 'eglot-flymake-backend nil t)
+    (flymake-mode 1)
     (if (eglot--current-process)
         (eglot--signalDidOpen)
       (if (y-or-n-p "No process, try to start one with `eglot-new-process'? ")
@@ -857,7 +857,10 @@ running.  INTERACTIVE is t if called interactively."
 (defun eglot-flymake-backend (report-fn &rest _more)
   "An EGLOT Flymake backend.
 Calls REPORT-FN maybe if server publishes diagnostics in time."
-  ;; FIXME: perhaps should call it immediately?
+  ;; call immediately with no diagnostics, this just means we don't
+  ;; have them yet (and also clears any pending ones).
+  ;;
+  (funcall report-fn nil)
   (setq eglot--current-flymake-report-fn report-fn)
   (eglot--maybe-signal-didChange))
 

Reply via email to