tpope / vim-fireplace

fireplace.vim: Clojure REPL support
https://www.vim.org/scripts/script.php?script_id=4978
1.74k stars 139 forks source link

pretty printing has moved from cider into nrepl #329

Closed SevereOverfl0w closed 5 years ago

SevereOverfl0w commented 5 years ago

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.

bbatsov commented 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).

SevereOverfl0w commented 5 years ago

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.

bbatsov commented 5 years ago

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.

SevereOverfl0w commented 5 years ago

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.

bbatsov commented 5 years ago

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.