Variable: cider-xref-tree--implements-code

cider-xref-tree--implements-code is a variable defined in cider-xref-tree.el.

Value

"(let [v (resolve '%s) x (when v (deref v))]\n     (into [(cond (instance? clojure.lang.MultiFn x) \"multimethod\"\n                  (and (map? x) (:on-interface x)) \"protocol\"\n                  :else \"other\")]\n           (cond (instance? clojure.lang.MultiFn x)\n                 (mapv pr-str (sort-by str (keys (methods x))))\n                 (and (map? x) (:on-interface x))\n                 (sort (mapv #(.getName ^Class %%) (extenders x)))\n                 :else [])))"

Documentation

Clojure form (with a %s for the var) classifying it and listing its impls.

Returns a vector whose head is "protocol", "multimethod" or "other" and whose tail is the implementation names (extender classes or dispatch values).

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-xref-tree.el
;;; who-implements - protocol/multimethod implementations.
;;
;; When cider-nrepl provides the `cider/who-implements' op we use it: it sees
;; inline `defrecord'/`deftype' implementers (not just `extend' targets) and
;; carries a source location for each, so every implementation is a jump target.
;;
;; Without the op we fall back to a client-side approximation - evaluating a
;; little introspection form to read a protocol's `extenders' or a multimethod's
;; dispatch values.  That can't see inline implementers and has no per-impl
;; locations, but it keeps the command useful against older middleware.

(defconst cider-xref-tree--implements-code
  "(let [v (resolve '%s) x (when v (deref v))]
     (into [(cond (instance? clojure.lang.MultiFn x) \"multimethod\"
                  (and (map? x) (:on-interface x)) \"protocol\"
                  :else \"other\")]
           (cond (instance? clojure.lang.MultiFn x)
                 (mapv pr-str (sort-by str (keys (methods x))))
                 (and (map? x) (:on-interface x))
                 (sort (mapv #(.getName ^Class %%) (extenders x)))
                 :else [])))"
  "Clojure form (with a `%s' for the var) classifying it and listing its impls.
Returns a vector whose head is \"protocol\", \"multimethod\" or \"other\" and
whose tail is the implementation names (extender classes or dispatch values).")