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