Skip to content

Commit

Permalink
Don't ignore flymake-no-changes-timeout
Browse files Browse the repository at this point in the history
Also per joaotavora/eglot#957.

Only actually and eagerly report LSP diagnotics if the user has
Flymake starting automatically on a timer (flymake-no-changes-timeout
is a number).

By contrast, if flymake-no-changes-timeout is nil, the user starts the
diagnostic collection process on-demand via 'M-x flymake-start'.

Since the control of such collection is impossible with LSP, we should
just hold on to whatever diagnostics we have (which are presumably
up-to-date) until the next invocation of 'eglot-flymake-backend'.

For now, this doesn't affect Flymake "list-only" diagnostics.  Those
are reported via the 'flymake-list-only-diagonstics' variable and
are always communicated immediately to it.

* eglot.el: (eglot-handle-notification
textDocument/publishDiagnostics): Consult flymake-no-changes-timeout.

Suggested-by: Jim Davis <jim.jd.davis@gmail.com>
GitHub-reference: fix joaotavora/eglot#508
  • Loading branch information
joaotavora committed May 19, 2022
1 parent 25be2d5 commit 721c102
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lisp/progmodes/eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -1996,7 +1996,11 @@ COMMAND is a symbol naming the command."
collect it)))
`((face . ,faces))))))
into diags
finally (cond (eglot--current-flymake-report-fn
finally (cond ((and
;; only add to current report if Flymake
;; starts on idle-timer (github#958)
(not (null flymake-no-changes-timeout))
eglot--current-flymake-report-fn)
(eglot--report-to-flymake diags))
(t
(setq eglot--diagnostics diags)))))
Expand Down

0 comments on commit 721c102

Please sign in to comment.