Skip to content

Commit

Permalink
Rely on the lookup nREPL op if we can't see the CIDER info op #137
Browse files Browse the repository at this point in the history
  • Loading branch information
Olical committed May 14, 2022
1 parent 84c81b8 commit 868e66e
Show file tree
Hide file tree
Showing 2 changed files with 220 additions and 204 deletions.
28 changes: 18 additions & 10 deletions fnl/conjure/client/clojure/nrepl/action.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,24 @@

(defn- with-info [opts f]
(server.with-conn-and-ops-or-warn
[:info]
(fn [conn]
[:info :lookup]
(fn [conn ops]
(server.send
{:op :info
:ns (or opts.context "user")
:symbol opts.code
:session conn.session}
(if
ops.info
{:op :info
:ns (or opts.context "user")
:symbol opts.code
:session conn.session}

ops.lookup
{:op :lookup
:ns (or opts.context "user")
:sym opts.code
:session conn.session})
(fn [msg]
(f (when (not msg.status.no-info)
msg)))))))
(or (. msg :info) msg))))))))

(defn- java-info->lines [{: arglists-str : class : member : javadoc}]
(a.concat
Expand Down Expand Up @@ -173,13 +181,13 @@
{:simple-out? true :ignore-nil? true})
msgs)
(do
(log.append ["; No results, checking CIDER's info op"])
(log.append ["; No results for (doc ...), checking nREPL info ops"])
(with-info
opts
(fn [info]
(if
(a.nil? info)
(log.append ["; Nothing found via CIDER's info either"])
(log.append ["; No information found, all I can do is wish you good luck and point you to https://duckduckgo.com/"])

(= :table (type info.javadoc))
(log.append (java-info->lines info))
Expand All @@ -188,7 +196,7 @@
(log.append
(a.concat
[(.. "; " info.ns "/" info.name)
(.. "; (" info.arglists-str ")")]
(.. "; " info.arglists-str)]
(text.prefixed-lines info.doc "; ")))

(log.append
Expand Down
Loading

0 comments on commit 868e66e

Please sign in to comment.