@@ -64,6 +64,15 @@ The max size can be also changed interactively within the inspector."
64
64
:type '(integer :tag " Max collection size" 5 )
65
65
:package-version '(cider . " 1.1.0" ))
66
66
67
+ (defcustom cider-inspector-max-nested-depth 5
68
+ " Default level of nesting for collections to display before truncating.
69
+ The max depth can be also changed interactively within the inspector."
70
+ :type '(integer :tag " Max nested collection depth" 5 )
71
+ :package-version '(cider . " 1.2.0" ))
72
+
73
+ (defvar cider-inspector-spacious-collections nil
74
+ " Controls whether the inspector renders values in collections spaciously." )
75
+
67
76
(defcustom cider-inspector-fill-frame nil
68
77
" Controls whether the CIDER inspector window fills its frame."
69
78
:type 'boolean
@@ -114,6 +123,7 @@ by clicking or navigating to them by other means."
114
123
(define-key map " s" #'cider-inspector-set-page-size )
115
124
(define-key map " a" #'cider-inspector-set-max-atom-length )
116
125
(define-key map " c" #'cider-inspector-set-max-coll-size )
126
+ (define-key map " C" #'cider-inspector-set-max-nested-depth )
117
127
(define-key map " d" #'cider-inspector-def-current-val )
118
128
(define-key map " t" #'cider-inspector-tap-current-val )
119
129
(define-key map " 1" #'cider-inspector-tap-at-point )
@@ -219,12 +229,7 @@ current buffer's namespace."
219
229
(interactive (list (cider-read-from-minibuffer " Inspect expression: " (cider-sexp-at-point))
220
230
(cider-current-ns)))
221
231
(setq cider-inspector--current-repl (cider-current-repl))
222
- (let ((result (cider-sync-request:inspect-expr
223
- expr ns
224
- cider-inspector-page-size
225
- cider-inspector-max-atom-length
226
- cider-inspector-max-coll-size
227
- 'v2 )))
232
+ (let ((result (cider-sync-request:inspect-expr expr ns 'v2 )))
228
233
(when (nrepl-dict-get result " value" )
229
234
(cider-inspector--render-value result 'v2 ))))
230
235
@@ -340,6 +345,14 @@ MAX-SIZE is the new value."
340
345
(when (nrepl-dict-get result " value" )
341
346
(cider-inspector--render-value result 'v2 ))))
342
347
348
+ (defun cider-inspector-set-max-nested-depth (max-nested-depth )
349
+ " Set the level of nesting for collections to display beflore truncating.
350
+ MAX-NESTED-DEPTH is the new value."
351
+ (interactive (list (read-number " Max nested depth: " cider-inspector-max-nested-depth)))
352
+ (let ((result (cider-sync-request:inspect-set-max-nested-depth max-nested-depth 'v2 )))
353
+ (when (nrepl-dict-get result " value" )
354
+ (cider-inspector--render-value result 'v2 ))))
355
+
343
356
(defcustom cider-inspector-preferred-var-names nil
344
357
" The preferred var names to be suggested by `cider-inspector-def-current-val' .
345
358
@@ -522,6 +535,17 @@ instead of just its \"value\" entry."
522
535
result
523
536
(nrepl-dict-get result " value" ))))
524
537
538
+ (defun cider-sync-request:inspect-set-max-nested-depth (max-nested-depth &optional v2 )
539
+ " Set the level of nesting for collections to display before truncating.
540
+ MAX-NESTED-DEPTH is the new value, V2 indicates if the entire response should be returned
541
+ instead of just its \" value\" entry."
542
+ (let ((result (thread-first `(" op" " inspect-set-max-nested-depth"
543
+ " max-nested-depth" , max-nested-depth )
544
+ (cider-nrepl-send-sync-request cider-inspector--current-repl))))
545
+ (if v2
546
+ result
547
+ (nrepl-dict-get result " value" ))))
548
+
525
549
(defun cider-sync-request:inspect-def-current-val (ns var-name &optional v2 )
526
550
" Defines a var with VAR-NAME in NS with the current inspector value,
527
551
V2 indicates if the entire response should be returned
@@ -545,22 +569,27 @@ instead of just its \"value\" entry."
545
569
" idx" , idx )
546
570
cider-inspector--current-repl))
547
571
548
- (defun cider-sync-request:inspect-expr (expr ns page-size max-atom-length max-coll-size &optional v2 )
572
+ (defun cider-sync-request:inspect-expr (expr ns &optional v2 )
549
573
" Evaluate EXPR in context of NS and inspect its result.
550
574
Set the page size in paginated view to PAGE-SIZE, maximum length of atomic
551
575
collection members to MAX-ATOM-LENGTH, and maximum size of nested collections to
552
576
MAX-COLL-SIZE if non nil,
553
577
V2 indicates if the entire response should be returned
554
578
instead of just its \" value\" entry."
555
- (let ((result (thread-first (append (nrepl--eval-request expr ns)
556
- `(" inspect" " true"
557
- ,@(when page-size
558
- `(" page-size" , page-size ))
559
- ,@(when max-atom-length
560
- `(" max-atom-length" , max-atom-length ))
561
- ,@(when max-coll-size
562
- `(" max-coll-size" , max-coll-size ))))
563
- (cider-nrepl-send-sync-request cider-inspector--current-repl))))
579
+ (let ((result (thread-first
580
+ (append (nrepl--eval-request expr ns)
581
+ `(" inspect" " true"
582
+ ,@(when cider-inspector-page-size
583
+ `(" page-size" , cider-inspector-page-size ))
584
+ ,@(when cider-inspector-max-atom-length
585
+ `(" max-atom-length" , cider-inspector-max-atom-length ))
586
+ ,@(when cider-inspector-max-coll-size
587
+ `(" max-coll-size" , cider-inspector-max-coll-size ))
588
+ ,@(when cider-inspector-max-nested-depth
589
+ `(" max-nested-depth" , cider-inspector-max-nested-depth ))
590
+ " spacious" ,(if cider-inspector-spacious-collections
591
+ " true" " false" )))
592
+ (cider-nrepl-send-sync-request cider-inspector--current-repl))))
564
593
(if v2
565
594
result
566
595
(nrepl-dict-get result " value" ))))
0 commit comments