A diagnostics-lazy server is one who doesn't re-report already
reported diagnostics when it received textDocument/didSave.
Such is the case of Clangd, for example. Before this change, saving
an Eglot/Clang-managed buffer with some diagnostics caused the Flymake
indicator to display Wait[0 0] until some change was actually done to
the buffer.
That is because Flymake, by default, wants diagnostics on buffer save,
per flymake-start-on-save-buffer. But it doesn't work to simply turn
that off. That's because if one types something and quickly saves,
and the LSP diagnostics do come in after the save (for some reason,
like server latency), then Flymake sometimes doesn't request any
diagnostics at all.
The reason for the Flymake behaviour wasn't investigated, but that
wasn't a very good solution either
Rather this change makes it so that when such a Flymake request comes
in, it always gets served immediately with the latest information.
The latest information is now always stored in eglot--diagnostics,
with eglot--unreported-diagnotics being removed. The up-to-date list
is reported to Flymake whenever it requests it. It is updated
whenever the LSP server decides to.
* eglot.el (eglot--last-reported-diagnostics): Delete.
(eglot--unreported-diagnostics): Delete.
(eglot--diagnostics): New variable..
(eglot--maybe-activate-editing-mode): Use eglot--diagnostics.
(eglot-handle-notification): Set eglot--diaggnostics.
(eglot-flymake-backend): Read eglot--diagnostics. Always report.
(eglot--report-to-flymake): Set eglot--diagnostics.