File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed
doc/modules/ROOT/pages/repl Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 13
13
* Add support for nREPL 0.8 ` completions ` op. It's used if ` cider-nrepl ` is not available.
14
14
* Add ` browser ` to the list of supported ClojureScript REPL types.
15
15
* Add an interactive command to toggle Clojure font-locking in the REPL (` cider-repl-toggle-clojure-font-lock ` ).
16
+ * Add a defcustom controlling nREPL's print buffer size (` cider-print-buffer-size ` ). It's set to 4K by default, nREPL own default is 1k.
16
17
17
18
### Changes
18
19
Original file line number Diff line number Diff line change @@ -264,6 +264,17 @@ Set to nil for no limit."
264
264
:group 'cider
265
265
:package-version '(cider . " 0.21.0" ))
266
266
267
+ (defcustom cider-print-buffer-size (* 4 1024 )
268
+ " The size in bytes of each value/output chunk when using print streaming.
269
+ Smaller values mean smaller data chunks and faster feedback, but they also mean
270
+ smaller results that can be font-locked as Clojure in the REPL buffers, as only
271
+ a single chunk result can be font-locked.
272
+
273
+ The default value in nREPL is 1024."
274
+ :type 'integer
275
+ :group 'cider
276
+ :package-version '(cider . " 0.25.0" ))
277
+
267
278
(defun cider--print-fn ()
268
279
" Return the value to send in the nrepl.middleware.print/print slot."
269
280
(pcase cider-print-fn
@@ -313,6 +324,8 @@ is included in the request if non-nil."
313
324
`((" nrepl.middleware.print/print" ,(cider--print-fn))))
314
325
(when cider-print-quota
315
326
`((" nrepl.middleware.print/quota" , cider-print-quota )))
327
+ (when cider-print-buffer-size
328
+ `((" nrepl.middleware.print/buffer-size" , cider-print-buffer-size )))
316
329
(unless (nrepl-dict-empty-p print-options)
317
330
`((" nrepl.middleware.print/options" , print-options ))))))
318
331
Original file line number Diff line number Diff line change @@ -152,6 +152,18 @@ each chunk is font-locked by itself and the results can't really be combined
152
152
* The font-locking of results is an expensive operation which involves copying the value
153
153
to a temporary buffer, where we check its integrity and do the actual font-locking.
154
154
155
+ By default CIDER instructs nREPL to stream data in 4K chunks, but you can easily modify this:
156
+
157
+ [source,lisp]
158
+ ----
159
+ ;; let's stream data in 8K chunks
160
+ (setq cider-print-buffer-size (8 * 1024))
161
+ ----
162
+
163
+ Setting this to `nil` will result in using nREPL's default `buffer-size` of 1024 bytes.
164
+ The smaller the print buffer size the faster you'll get feedback/updates in the REPL, so generally
165
+ it's a good idea to stick to some relatively small size.
166
+
155
167
TIP: If you'd like to learn more about the font-locking of results you can check
156
168
out the definition of `clojure-font-lock-as` and `clojure-font-lock-as-clojure`
157
169
in `cider-util.el`.
You can’t perform that action at this time.
0 commit comments