From 2b8142d285a0a545abf4cbbe108443b861c50959 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Wed, 2 May 2018 15:49:41 +0100 Subject: [PATCH] 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. --- lisp/progmodes/eglot.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index d3428a73a74..aa23252271c 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/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)) -- 2.39.2