File tree Expand file tree Collapse file tree 3 files changed +9
-16
lines changed Expand file tree Collapse file tree 3 files changed +9
-16
lines changed Original file line number Diff line number Diff line change 82
82
(def wrap-pprint-fn-optional-arguments
83
83
" Common pprint arguments for CIDER's middleware."
84
84
{" pprint-fn" " The namespace-qualified name of a 1 or 2-arity function to use for pretty-printing. Defaults to `cider.nrepl.pprint/pprint`."
85
- " print-params " " A map of configuration entries that the pprint-fn will understand. Those would typically be specific to the pprint-fn in question." })
85
+ " print-options " " A map of configuration entries that the pprint-fn will understand. Those would typically be specific to the pprint-fn in question." })
86
86
87
87
(def-wrapper wrap-pprint-fn cider.nrepl.middleware.pprint /handle-pprint-fn
88
88
(fn [msg] true )
94
94
`cider.nrepl.pprint/pprint`. The function name can be passed as
95
95
a string or symbol. Note that function should take 1 or two params - the
96
96
object to print and the an optional map of print params. The params should
97
- be passed as `:print-params` - a map of key/value params. If they were passed
98
- by the client as with string keys, this middleware will convert the keys to
99
- keywords.
97
+ be passed as `:print-options` - a map of key/value params.
100
98
101
99
The `:pprint-fn` slot will be replaced with the var that maps to the name
102
100
that was initially passed.
103
101
104
102
Middlewares further down the stack can then look up the `:pprint-fn`
105
- slot, call it where necessary, and pass it the value of the `:print-params ` slot."
103
+ slot, call it where necessary, and pass it the value of the `:print-options ` slot."
106
104
:requires #{#'session}
107
105
:expects #{" eval" " load-file" }})
108
106
Original file line number Diff line number Diff line change 2
2
(:require
3
3
[cider.nrepl.middleware.util.cljs :as cljs]
4
4
cider.nrepl.pprint
5
- [clojure.walk :as walk]
6
5
[nrepl.middleware.interruptible-eval :refer [*msg*]]
7
6
[nrepl.middleware.pr-values :refer [pr-values]]
8
7
[nrepl.middleware.session :as session]
26
25
27
26
(defn handle-pprint-fn
28
27
[handler msg]
29
- (let [{:keys [pprint-fn print-options session ]
28
+ (let [{:keys [pprint-fn]
30
29
:or {pprint-fn 'cider.nrepl.pprint/pprint}}
31
30
msg]
32
- (handler (assoc msg
33
- :pprint-fn (resolve-pprint-fn pprint-fn)
34
- :print-options (walk/keywordize-keys print-options)))))
31
+ (handler (assoc msg :pprint-fn (resolve-pprint-fn pprint-fn)))))
Original file line number Diff line number Diff line change 3
3
All functions here are simple wrappers that ensure a consistent API:
4
4
5
5
* has one and two params signatures - object to print and a map of print options
6
- * the keys of the print options map can be strings, as bencode clients can't send keywords
7
6
* functions return the printed object as a string"
8
7
{:added " 0.20.0" }
9
8
(:require
10
- [clojure.pprint :as pp]
11
- [clojure.walk :as walk]))
9
+ [clojure.pprint :as pp]))
12
10
13
11
(defn pprint
14
12
" A simple wrapper around `clojure.pprint/write`.
17
15
([object]
18
16
(pprint object {}))
19
17
([object opts]
20
- (let [opts (assoc ( walk/keywordize-keys opts) :stream nil )]
18
+ (let [opts (assoc opts :stream nil )]
21
19
(apply pp/write object (vec (flatten (vec opts)))))))
22
20
23
21
(def ^:private fipp-printer
31
29
(fipp-pprint object {}))
32
30
([object opts]
33
31
(with-out-str
34
- (@fipp-printer object ( walk/keywordize-keys opts) ))))
32
+ (@fipp-printer object opts))))
35
33
36
34
(def ^:private puget-printer
37
35
(delay
43
41
([object]
44
42
(puget-pprint object {}))
45
43
([object opts]
46
- (@puget-printer object ( walk/keywordize-keys opts) )))
44
+ (@puget-printer object opts)))
You can’t perform that action at this time.
0 commit comments