]> git.eshelyaron.com Git - emacs.git/commitdiff
Ready to start fixing flymake integration
authorJoão Távora <joaotavora@gmail.com>
Wed, 2 May 2018 14:49:41 +0000 (15:49 +0100)
committerJoão Távora <joaotavora@gmail.com>
Wed, 2 May 2018 14:50:17 +0000 (15:50 +0100)
* eglot.el (eglot-editing-mode): Turn on flymake-mode.
(eglot-flymake-backend): Always start by reporting no diagnostics.
(eglot--textDocument/publishDiagnostics): No annoying message.

lisp/progmodes/eglot.el

index d3428a73a74f2157fdb941a059c1c85db515a543..aa23252271c85cfe0547b93aef32948436726471 100644 (file)
@@ -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))