Function: eglot--flymake-report-push+pulled

eglot--flymake-report-push+pulled is a byte-compiled function defined in eglot.el.gz.

Signature

(eglot--flymake-report-push+pulled &key FORCE)

Documentation

Push previously collected diagnostics to eglot--flymake-report-fn.

If KEEP, knowingly push a dummy do-nothing update.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/eglot.el.gz
(cl-defun eglot--flymake-report-push+pulled
    (&key force
     &aux
     (pushed-docver (cadr eglot--pushed-diagnostics))
     (pushed-outdated-p (and pushed-docver (< pushed-docver eglot--docver))))
  "Push previously collected diagnostics to `eglot--flymake-report-fn'.
If KEEP, knowingly push a dummy do-nothing update."
  ;; Maybe hack in diagnostics we previously may have saved in
  ;; `flymake-list-only-diagnostics', pushed for this file before it was
  ;; visited (github#1531).
  (when-let* ((hack (and (<= eglot--docver 0)
                         (null eglot--pushed-diagnostics)
                         (cdr (assoc (buffer-file-name)
                                     flymake-list-only-diagnostics)))))
    (cl-loop
     for x in hack
     collect (alist-get 'eglot-lsp-diag (flymake-diagnostic-data x)) into res
     finally (setq eglot--pushed-diagnostics `(,(vconcat res) ,eglot--docver))))
  (eglot--widening
   (if (and (null eglot--pulled-diagnostics) pushed-outdated-p)
       ;; Here, we don't have anything interesting to give to Flymake.
       ;; Either a textDocument/diagnostics response specifically told
       ;; use that nothing changed, or `flymake-start' kicked in before
       ;; server had a chance to push something.  We just want to keep
       ;; whatever diagnostics it has annotated in the buffer and and
       ;; clear a possible "Wait" state.
       (eglot--flymake-report-2 nil :stay)
     (cl-macrolet ((report (x m)
                     `(eglot--flymake-report-1
                       (car ,x) ,m :force force)))
       (report eglot--pulled-diagnostics :clear)
       (unless pushed-outdated-p
         (report eglot--pushed-diagnostics :stay))))))