A new CLI: https://github.com/borkdude/puget-cli Can be used to colorize / pprint EDN.
I'm having issues showing the documentation of a variable using CIDER (with C-c C-d C-d
or cider-doc
). It doesn't use the symbol at point, and even if I type it, it returns an error. Example trace with map
:
Debugger entered--Lisp error: (wrong-type-argument stringp ([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]))
string-match("\n" ([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]) 0)
split-string(([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]) "\n")
cider-docview-render-info(#<buffer *cider-doc*> (dict "ns" "clojure.core" "name" "map" "built-in" t "arglists" "([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 &..." "doc" "Returns a lazy sequence consisting of the result o..." "file" "" "arglists-str" ([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])))
cider-docview-render(#<buffer *cider-doc*> "map" (dict "ns" "clojure.core" "name" "map" "built-in" t "arglists" "([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 &..." "doc" "Returns a lazy sequence consisting of the result o..." "file" "" "arglists-str" ([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])))
cider-create-doc-buffer("map")
cider-doc-lookup("map")
cider-try-symbol-at-point("Doc for" cider-doc-lookup)
cider-doc(nil)
funcall-interactively(cider-doc nil)
call-interactively(cider-doc nil nil)
command-execute(cider-doc)
Does cider-doc require some non-standard nREPL middleware?
it would be helpful if you could post the output from the nrepl messages buffer
No idea. I'm almost positive cider-doc
worked before. I'll check the result from the nrepl buffer
You could try using an older release to double check if it worked before.
I'll try that, at the moment using:
`--> bb --version
babashka v0.2.3
CIDER 1.0.0snapshot (package: 20201020.1058)
(I just updated CIDER to see if it fixed the error, don't remember how old was my previous version)
I haven't checked older versions on the nrepl buffer yet, but looking at the error stacktrace I can see that the result from nrepl contains both an arglists
and an arglists-str
however neither is a string
And then CIDER is splitting arglists-str thinking it's a string, which throws the error
No there's no specific nrepl op for doc
instead eval
is used:
(-->
id "22"
op "eval"
session "31de0313-76e6-4bf8-89bf-22e284741af8"
time-stamp "2020-10-23 23:55:22.795699101"
code "
(do
(require '<http://clojure.java.io|clojure.java.io>)
(require 'clojure.walk)
(if-let [var (resolve 'map)]
(let [info (meta var)]
(-> info
(update :ns str)
(update :name str)
(update :file (comp str <http://clojure.java.io/resource|clojure.java.io/resource>))
(cond-> (:macro info) (update :macro str))
(cond-> (:special-form info) (update :special-form str))
(cond-> (:protocol info) (update :protocol str))
(cond-> (:arglists info) (update :arglists str))
(assoc :arglists-str (:arglists info))
(clojure.walk/stringify-keys)))))
"
)
(<--
id "22"
session "31de0313-76e6-4bf8-89bf-22e284741af8"
time-stamp "2020-10-23 23:55:22.805649515"
ns "hello"
value "{\"ns\" \"clojure.core\", \"name\" \"map\", \"built-in\" true, \"arglists\" \"([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])\", \"doc\" \"Returns a lazy sequence consisting of the result of applying f to\\n the set of first items of each coll, followed by applying f to the\\n set of second items in each coll, until any one of the colls is\\n exhausted. Any remaining items in other colls are ignored. Function\\n f should accept number-of-colls arguments. Returns a transducer when\\n no collection is provided.\", \"file\" \"\", \"arglists-str\" ([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])}"
)
.... sorry, this is my bad, it comes from my config customization
ok
I completely forgot, but I added support for cider-doc myself a few months ago, I guess the code is out of date now
the clj function in the nrepl eval
comes from my config
Hey no, it doesn't! https://github.com/clojure-emacs/cider/blob/1be3b89c00d9fe6d2b69e5b719d168e22d333a25/cider-client.el#L422 This is late for me, so I'll continue to investigate this tomorrow and will create an issue in babashka/nrepl then
Nevermind, found it, and it's a bug in cider, I'll file a report there.
The eval code is a fallback when there's no nrepl support for the op info
, which is why it happens on babashka.
Commit in question: https://github.com/clojure-emacs/cider/commit/1be3b89c00d9fe6d2b69e5b719d168e22d333a25
That expression does seem to work when evaluated as a normal bb script
E.g. for map
I get:
{"ns" "clojure.core", "name" "map", "built-in" true, "arglists" "([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])", "doc" "Returns a lazy sequence consisting of the result of applying f to\n the set of first items of each coll, followed by applying f to the\n set of second items in each coll, until any one of the colls is\n exhausted. Any remaining items in other colls are ignored. Function\n f should accept number-of-colls arguments. Returns a transducer when\n no collection is provided.", "file" "", "arglists-str" ([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])}
`the eval works, but the commit introduced a bug: arglists-str is not a string anymore
so emacs throws when trying to split it by \n
ah ok
Getting late here too, I think we're in the same timezone
now yes! I did a tad of work on babashka/nrepl when I was in Singapore, but now I'm in france to visit my family
ah nice.
I care about having babashka work well with cider ahah
good night then
same to you :)