Function: cider-eldoc--request-async

cider-eldoc--request-async is a byte-compiled function defined in cider-eldoc.el.

Signature

(cider-eldoc--request-async THING K)

Documentation

Request cider/eldoc for THING asynchronously and call K with the dict or nil.

Unlike the synchronous path this never blocks Emacs, so it needs no abort-on-input.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-eldoc.el
(defun cider-eldoc--request-async (thing k)
  "Request `cider/eldoc' for THING asynchronously and call K with the dict or nil.
Unlike the synchronous path this never blocks Emacs, so it needs no
`abort-on-input'."
  (if-let* ((connection (cider-current-repl)))
      (let ((accumulated nil))
        (cider-nrepl-send-request
         `("op" "cider/eldoc"
           "ns" ,(cider-current-ns)
           "sym" ,thing
           "context" ,(cider-completion-get-context t))
         (lambda (response)
           (nrepl-dbind-response response (status id)
             (setq accumulated (if accumulated
                                   (nrepl-dict-merge accumulated response)
                                 response))
             (when (member "done" status)
               ;; Eldoc fires on nearly every cursor move, so the request must
               ;; be retired from `nrepl-pending-requests' once done - otherwise
               ;; the table grows unbounded for the whole session.
               (nrepl--mark-id-completed id)
               (funcall k accumulated))))
         connection))
    (funcall k nil)))