Function: eglot--flymake-pull

eglot--flymake-pull is a byte-compiled function defined in eglot.el.gz.

Signature

(eglot--flymake-pull)

Documentation

Pull diagnostics from server, for all managed buffers.

When response arrives call registered eglot--flymake-push-report-fn.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/eglot.el.gz
(cl-defun eglot--flymake-pull (&aux (server (eglot--current-server-or-lose))
                                    (origin (current-buffer)))
  "Pull diagnostics from server, for all managed buffers.
When response arrives call registered `eglot--flymake-push-report-fn'."
  (cl-flet
      ((pull-for (buf &optional then)
         (with-current-buffer buf
           (let ((version eglot--docver)
                 (prev-result-id (nth 2 eglot--diagnostics)))
             (eglot--async-request
              server
              :textDocument/diagnostic
              (append
               `(:textDocument ,(eglot--TextDocumentIdentifier)
                               ,@(when prev-result-id
                                   `(:previousResultId ,prev-result-id))))
              :success-fn
              (eglot--lambda ((DocumentDiagnosticReport) kind items resultId)
                (eglot--when-live-buffer buf
                  (pcase kind
                    ("full"
                     (setq eglot--diagnostics
                           (list
                            (cl-loop
                             for spec across items
                             collect (eglot--flymake-make-diag spec version))
                            version
                            resultId))
                     (eglot--flymake-push))
                    ("unchanged"
                     (when (eq buf origin) (eglot--flymake-push 'void)))))
                (when then (funcall then)))
              :hint :textDocument/diagnostic)))))
    ;; JT@2025-12-15: No known server yet supports "relatedDocuments" so
    ;; the only way we have to get related diagnostics is to explicitly
    ;; request them of all open documents.  Moreover, experience has
    ;; shown this needs to happen after the 'origin''s response.
    (pull-for origin
              (unless (zerop eglot--docver)
                (lambda ()
                  (mapc #'pull-for
                        (remove origin (eglot--managed-buffers server))))))))