Function: cider-eldoc--build-info

cider-eldoc--build-info is a byte-compiled function defined in cider-eldoc.el.

Signature

(cider-eldoc--build-info THING ELDOC-INFO)

Documentation

Build (and cache) the eldoc plist for THING from the ELDOC-INFO response dict.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-eldoc.el
(defun cider-eldoc--build-info (thing eldoc-info)
  "Build (and cache) the eldoc plist for THING from the ELDOC-INFO response dict."
  (let* ((arglists (nrepl-dict-get eldoc-info "eldoc"))
         (docstring (nrepl-dict-get eldoc-info "docstring"))
         (type (nrepl-dict-get eldoc-info "type"))
         (ns (nrepl-dict-get eldoc-info "ns"))
         (class (nrepl-dict-get eldoc-info "class"))
         (name (nrepl-dict-get eldoc-info "name"))
         (member (nrepl-dict-get eldoc-info "member"))
         (ns-or-class (if (and ns (not (string= ns "")))
                          ns
                        class))
         (name-or-member (if (and name (not (string= name "")))
                             name
                           (format ".%s" member)))
         (eldoc-plist (list "ns" ns-or-class
                            "class" class
                            "symbol" name-or-member
                            "arglists" arglists
                            "docstring" docstring
                            "doc-fragments" (nrepl-dict-get eldoc-info "doc-fragments")
                            "doc-first-sentence-fragments" (nrepl-dict-get eldoc-info
                                                                           "doc-first-sentence-fragments")
                            "doc-block-tags-fragments" (nrepl-dict-get eldoc-info
                                                                       "doc-block-tags-fragments")
                            "type" type)))
    ;; add context dependent args if requested by defcustom
    ;; do not cache this eldoc info to avoid showing info
    ;; of the previous context
    (if cider-eldoc-display-context-dependent-info
        (cond
         ;; add inputs of datomic query
         ((and (equal ns-or-class "datomic.api")
               (equal name-or-member "q"))
          (cider-plist-put eldoc-plist "arglists"
                           (cider--eldoc-add-datomic-query-inputs-to-arglists
                            (cider-plist-get eldoc-plist "arglists"))))
         ;; if none of the clauses is successful, do cache the eldoc
         (t (setq cider-eldoc-last-symbol (list thing eldoc-plist))))
      ;; middleware eldoc lookups are expensive, so we cache the last lookup.
      ;; This eliminates the need for extra middleware requests within the same sexp.
      (setq cider-eldoc-last-symbol (list thing eldoc-plist)))
    eldoc-plist))