From 34f10965a9ec00adf56a3cba55f53ae199d388c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Wed, 6 Jun 2018 12:04:39 +0100 Subject: [PATCH] Slightly polish the flymake integration For backends, like RLS, that don't textDocument/publishDiagnostics right away, assume that the file is clean. Since Flymake allows multiple reportings, it should be OK. * eglot.el (eglot--unreported-diagnostics): Move variable up here. (eglot--maybe-activate-editing-mode): Assume no diagnostics on open. --- lisp/progmodes/eglot.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 5ede7910356..81a63fdbea9 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -900,6 +900,9 @@ If optional MARKERS, make markers." (add-hook 'eglot--managed-mode-hook 'flymake-mode) (add-hook 'eglot--managed-mode-hook 'eldoc-mode) +(defvar-local eglot--unreported-diagnostics nil + "Unreported Flymake diagnostics for this buffer.") + (defun eglot--maybe-activate-editing-mode (&optional server) "Maybe activate mode function `eglot--managed-mode'. If SERVER is supplied, do it only if BUFFER is managed by it. In @@ -908,6 +911,7 @@ that case, also signal textDocument/didOpen." (let* ((cur (and buffer-file-name (eglot--current-server))) (server (or (and (null server) cur) (and server (eq server cur) cur)))) (when server + (setq eglot--unreported-diagnostics `(:just-opened . nil)) (eglot--managed-mode-onoff server 1) (eglot--signal-textDocument/didOpen)))) @@ -1057,9 +1061,6 @@ function with the server still running." (_server (_method (eql :telemetry/event)) &rest _any) "Handle notification telemetry/event") ;; noop, use events buffer -(defvar-local eglot--unreported-diagnostics nil - "Unreported diagnostics for this buffer.") - (cl-defmethod eglot-handle-notification (server (_method (eql :textDocument/publishDiagnostics)) &key uri diagnostics) "Handle notification publishDiagnostics" -- 2.39.2