Is there a reason why zprint dependencies are not provided directly with cider-nrepl as they are with puget and fipp?
Puget and fipp are grandfathered in. They'd be removed if it wouldn't break the backwards compatibility. The goal is to make cider lighter.
Oki. Not sending the PR then. 😎
I am having problems giving zprint
this option map over nREPL: {:record {:to-string? true}}
, because I don’t seem to be able to bencode booleans to anything else but 0/1, and zprint checks that it is a boolean… Is it possible to send a boolean proper over bencode? Or is there some other way I can achieve this? Feels like a problem I should have encountered before, but I haven’t…
I wonder if we should read-string the value?
It feels quite limiting to only be able to use what can survive the bencode conversion to and fro
Googling ":nrepl.middleware.print/options"
doesn't yield that many results, so I'm guessing this doesn't get used much other than to pass {:right-margin 70}
or similar around
Yeah, it is a bit surprising that it took me so long to run in to this limitation. A bit hard to see how it could be fixed though...
I think if we allowed that to be passed as a (edn) string (v.s. bencode map), that could be better?
that would require a (non-breaking) change to nrepl though
Could be made opt in, though?
yes definitely
(if-not (string? opt) opt (read-string opt))
in the right place
I was more thinking in some config of the transport.
guess we could even allow boolean in the bencode transport. Would just need to think about how to encode it
(I don't think it's part of the bencode spec)
It isn't. But, yeah, doesn't need to be. haha.
b0e
/`b1e`, or bfe
/`bte`, maybe.
Would be nice to be able to transfer nil
as well.
I just had a look around at how various other bencode implementations dealt with this. Nothing jumped out as an especially good options
something different:
what are you trying to use as the print-fn for zprint?
zprint.core/zprint
doesn't have the right signature
it needs to be [value writer options]
not actually sure what has that signature, other than the built in fn's
(i.e. to use zprint, you might need to provide a wrapper fn anyways
I'm using cider.nrepl.pprint/zprint-pprint
, and providing the options via nrepl.middleware.print/options
.
ah-ha
then think it might be better to patch https://github.com/clojure-emacs/cider-nrepl/blob/7cdbe4d32b4893ab1d856b92cc802f96bb31f1f5/src/cider/nrepl/pprint.clj#L86 to coerce :to-string?
to boolean
(if (get-in options [:record :to-string?]) (update-in options [:record :to-string?] boolean) options)
cider-nrepl releases way more frequently than nrepl itself
Kim Kinnear is going to relax the spec to allow for 1
as representing not false
. So this particular option will be covered that way.