Closed SevereOverfl0w closed 5 years ago
The relevant documentation is here https://nrepl.org/nrepl/0.6.0/design/middleware.html#_pretty_printing
In nREPL you can also elect to get the value streamed (split in several chunks), so that interrupt an evaluation that results in some huge output (and get the initial feedback much faster).
we could potentially take advantage of that (I do some similar things in replant) but it would require some reworking to how fireplace is set up.
The annoyance (for me) is that fireplace can't set the default to something like fipp, and has to use clojure.pprint/pprint as the default because that's the only thing that's always available. fipp is significantly superior in speed though.
Well, I guess it can check if cider-nrepl
is around and fallback to clojure.pprint
. I assume most fireplace users use it with cider-nrepl, so that shouldn't be a big deal.
I'm often surprised how many people use fireplace without cider-nrepl! Maybe as part of the init on the connection we can attempt to detect cider.
If we could sideload we could bring our own pretty printers which would make this redundant.
Indeed. That's why I view https://github.com/nrepl/nrepl/pull/109 as the most important improvement left for nREPL.
With it in place you'll also be able to just inject Orchard and few other regular libs and be able to do a lot of things just by evaluating stuff, although this would also require clients to parse EDN, which I hear is a solved problem in vim.
This means that the current pretty printing only works with cider<20. For cider>=20 we will need to rely on the middleware that's now in nrepl.
The upside is that the version in nrepl is less special, it outputs to :value for example. It also supports
zprint
, which is an excellent code formatter.