22
33== Configuring a printing function  
44
5- NOTE: Pretty-printing was overhauled in CIDER 0.21 to leverage new features introduced in nREPL 0.6.
6- Refer to https://nrepl.org/nrepl/usage/misc.html#_pretty_printing[nREPL's documentation] for details.
5+ NOTE: CIDER relies on nREPL's own value printing mechanism. Refer to
6+ https://nrepl.org/nrepl/usage/misc.html#pretty_printing[nREPL's documentation]
7+ for details.
78
89You can configure the function used by CIDER for pretty-printing evaluation
910results and other data using the option `cider-print-fn`, which can take the
@@ -15,14 +16,16 @@ equivalent of `clojure.core/pr`.
1516* `pr` to use the equivalent of `clojure.core/pr`.
1617* `pprint` to use the built-in `clojure.pprint/pprint` (this is the default).
1718* `fipp` to use the https://github.com/brandonbloom/fipp[Fast Idiomatic
18- Pretty-Printer]. This is approximately
19- 5-10x faster than `clojure.core/pprint`.
19+ Pretty-Printer]. This is approximately 5-10x faster than `clojure.core/pprint`.
2020* `puget` to use https://github.com/greglook/puget[Puget], which provides
2121https://github.com/greglook/puget#canonical-representation[canonical serialization]
2222of data on top of fipp, but at a slight performance cost.
2323* `zprint` to use https://github.com/kkinnear/zprint[zprint], a fast and
2424flexible alternative to the libraries mentioned above.
2525
26+ For `fipp`, `puget`, and `zprint` printers to work, you need to add a
27+ respective dependency into your project explicitly.
28+ 
2629Alternatively, `cider-print-fn` can be set to the namespace-qualified name of a
2730Clojure var whose function takes three arguments: the object to print, the
2831`java.io.PrintWriter` to print on, and a (possibly nil) map of options.
@@ -49,11 +52,6 @@ Here's one example:
4952  (apply pp/write value (mapcat identity (assoc options :stream writer)))) 
5053---- 
5154
52- IMPORTANT: Before Clojure 1.10.2, a
53- https://clojure.atlassian.net/browse/CLJ-1445[bug] in `clojure.pprint` caused it
54- to not work properly with `+*print-meta*+`. If you need to print the metadata
55- you'll have to change the print function or disable pretty-printing.
56- 
5755== Limiting printed output
5856
5957You can set `cider-print-quota` to limit the number of bytes that will be
0 commit comments