Function: cider--eldoc-format-class-names

cider--eldoc-format-class-names is a byte-compiled function defined in cider-eldoc.el.

Signature

(cider--eldoc-format-class-names CLASS-NAMES)

Documentation

Return a formatted CLASS-NAMES prefix string.

CLASS-NAMES is a list of classes to which a Java interop form belongs. Only keep the first cider-eldoc-max-class-names-to-display names, and add a "& x more" suffix. Return nil if the CLASS-NAMES list is empty or mapping cider-eldoc-ns-function on it returns an empty list.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-eldoc.el
(defun cider--eldoc-format-class-names (class-names)
  "Return a formatted CLASS-NAMES prefix string.
CLASS-NAMES is a list of classes to which a Java interop form belongs.
Only keep the first `cider-eldoc-max-class-names-to-display' names, and
add a \"& x more\" suffix.  Return nil if the CLASS-NAMES list is empty or
mapping `cider-eldoc-ns-function' on it returns an empty list."
  (when-let* ((eldoc-class-names (seq-remove #'null (mapcar (apply-partially cider-eldoc-ns-function) class-names)))
              (eldoc-class-names-length (length eldoc-class-names)))
    (cond
     ;; truncate class-names list and then format it
     ((and cider-eldoc-max-class-names-to-display
           (> eldoc-class-names-length cider-eldoc-max-class-names-to-display))
      (format "(%s & %s more)"
              (thread-first
                eldoc-class-names
                (seq-take cider-eldoc-max-class-names-to-display)
                (string-join " ")
                (cider-propertize 'ns))
              (- eldoc-class-names-length cider-eldoc-max-class-names-to-display)))

     ;; format the whole list but add surrounding parentheses
     ((> eldoc-class-names-length 1)
      (format "(%s)"
              (thread-first
                eldoc-class-names
                (string-join " ")
                (cider-propertize 'ns))))

     ;; don't add the parentheses
     (t (format "%s" (car eldoc-class-names))))))