Variable: cider-xref-tree--type-protocols-code

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

Value

"(let [sym '%s\n         r (try (resolve sym) (catch Throwable _ nil))\n         c (cond (class? r) r\n                 (and (var? r) (class? (deref r))) (deref r)\n                 (var? r) (class (deref r))\n                 :else (try (Class/forName (str sym)) (catch Throwable _ nil)))]\n     (when c\n       (vec (sort (for [ns (all-ns)\n                        [s v] (ns-publics ns)\n                        :let [val (try (deref v) (catch Throwable _ nil))]\n                        :when (and (map? val) (:on-interface val)\n                                   (or (extends? val c)\n                                       (.isAssignableFrom ^Class (:on-interface val) c)))]\n                    (str (symbol (str ns) (str s))))))))"

Documentation

Clojure form (with a %s for the type) listing the protocols it implements.

Covers both extend-style and inline defrecord/deftype implementations.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-xref-tree.el
;;; Protocol exploration - reverse lookup and method search.
;;
;; Both scan the loaded protocols (a protocol var derefs to a map with an
;; `:on-interface') and report the matches as qualified names, jumping to each
;; protocol's definition.  Client-side eval is enough here: the answers are
;; protocols, which are ordinary locatable vars.  Loaded JVM Clojure only.

(defconst cider-xref-tree--type-protocols-code
  "(let [sym '%s
         r (try (resolve sym) (catch Throwable _ nil))
         c (cond (class? r) r
                 (and (var? r) (class? (deref r))) (deref r)
                 (var? r) (class (deref r))
                 :else (try (Class/forName (str sym)) (catch Throwable _ nil)))]
     (when c
       (vec (sort (for [ns (all-ns)
                        [s v] (ns-publics ns)
                        :let [val (try (deref v) (catch Throwable _ nil))]
                        :when (and (map? val) (:on-interface val)
                                   (or (extends? val c)
                                       (.isAssignableFrom ^Class (:on-interface val) c)))]
                    (str (symbol (str ns) (str s))))))))"
  "Clojure form (with a `%s' for the type) listing the protocols it implements.
Covers both `extend'-style and inline `defrecord'/`deftype' implementations.")