@@ -84,6 +84,16 @@ The max depth can be also changed interactively within the inspector."
84
84
:type 'boolean
85
85
:package-version '(cider . " 1.18.0" ))
86
86
87
+ (defcustom cider-inspector-sort-maps nil
88
+ " When true, sort inspected maps by keys."
89
+ :type 'boolean
90
+ :package-version '(cider . " 1.19.0" ))
91
+
92
+ (defcustom cider-inspector-only-diff nil
93
+ " When true and inspecting a diff result, only display values that differ."
94
+ :type 'boolean
95
+ :package-version '(cider . " 1.19.0" ))
96
+
87
97
(defcustom cider-inspector-skip-uninteresting t
88
98
" Controls whether to skip over uninteresting values in the inspector.
89
99
Only applies to navigation with `cider-inspector-prev-inspectable-object'
@@ -147,6 +157,8 @@ Can be turned to nil once the user sees and acknowledges the feature."
147
157
(define-key map [(shift tab)] #'cider-inspector-previous-inspectable-object )
148
158
(define-key map " p" #'cider-inspector-previous-inspectable-object )
149
159
(define-key map " P" #'cider-inspector-toggle-pretty-print )
160
+ (define-key map " S" #'cider-inspector-toggle-sort-maps )
161
+ (define-key map " D" #'cider-inspector-toggle-only-diff )
150
162
(define-key map (kbd " C-c C-p" ) #'cider-inspector-print-current-value )
151
163
(define-key map " :" #'cider-inspect-expr-from-inspector )
152
164
(define-key map " f" #'forward-char )
@@ -185,6 +197,16 @@ Can be turned to nil once the user sees and acknowledges the feature."
185
197
(setq-local sesman-system 'CIDER )
186
198
(visual-line-mode 1 ))
187
199
200
+ (defun cider-inspector--highlight-diff-tags ()
201
+ " Apply face to #± using overlays. We use overlays here because font-locking
202
+ doesn't seem to work for this."
203
+ (save-excursion
204
+ (goto-char (point-min ))
205
+ (while (search-forward " #±" nil t )
206
+ (let ((overlay (make-overlay (match-beginning 0 ) (match-end 0 ))))
207
+ (overlay-put overlay 'face 'font-lock-warning-face )
208
+ (overlay-put overlay 'priority 100 )))))
209
+
188
210
;;;### autoload
189
211
(defun cider-inspect-last-sexp ()
190
212
" Inspect the result of the the expression preceding point."
@@ -354,9 +376,23 @@ MAX-NESTED-DEPTH is the new value."
354
376
(defun cider-inspector-toggle-pretty-print ()
355
377
" Toggle the pretty printing of values in the inspector."
356
378
(interactive )
357
- (let ((result (cider-nrepl-send-sync-request `(" op" " inspect-toggle-pretty-print" ))))
358
- (when (nrepl-dict-get result " value" )
359
- (cider-inspector--render-value result))))
379
+ (customize-set-variable 'cider-inspector-pretty-print (not cider-inspector-pretty-print))
380
+ (cider-inspector--refresh-with-opts
381
+ " pretty-print" (if cider-inspector-pretty-print " true" " false" )))
382
+
383
+ (defun cider-inspector-toggle-sort-maps ()
384
+ " Toggle the sorting of maps in the inspector."
385
+ (interactive )
386
+ (customize-set-variable 'cider-inspector-sort-maps (not cider-inspector-sort-maps))
387
+ (cider-inspector--refresh-with-opts
388
+ " sort-maps" (if cider-inspector-sort-maps " true" " false" )))
389
+
390
+ (defun cider-inspector-toggle-only-diff ()
391
+ " Toggle the display of only differing values when inspecting diff results."
392
+ (interactive )
393
+ (customize-set-variable 'cider-inspector-only-diff (not cider-inspector-only-diff))
394
+ (cider-inspector--refresh-with-opts
395
+ " only-diff" (if cider-inspector-only-diff " true" " false" )))
360
396
361
397
(defun cider-inspector-toggle-view-mode ()
362
398
" Toggle the view mode of the inspector between normal and object view mode."
@@ -454,8 +490,9 @@ MAX-COLL-SIZE if non nil."
454
490
`(" max-nested-depth" , cider-inspector-max-nested-depth ))
455
491
,@(when cider-inspector-display-analytics-hint
456
492
`(" display-analytics-hint" " true" ))
457
- ,@(when cider-inspector-pretty-print
458
- `(" pretty-print" " true" ))))
493
+ " pretty-print" ,(if cider-inspector-pretty-print " true" " false" )
494
+ " sort-maps" ,(if cider-inspector-sort-maps " true" " false" )
495
+ " only-diff" ,(if cider-inspector-only-diff " true" " false" )))
459
496
(cider-nrepl-send-sync-request)))
460
497
461
498
(declare-function cider-set-buffer-ns " cider-mode" )
@@ -522,7 +559,8 @@ from stack), `:next-inspectable' (move point to next inspectable object)."
522
559
" Render ELEMENTS."
523
560
(setq cider-inspector-looking-at-java-p nil )
524
561
(dolist (el elements)
525
- (cider-inspector-render-el* el)))
562
+ (cider-inspector-render-el* el))
563
+ (cider-inspector--highlight-diff-tags))
526
564
527
565
(defconst cider--inspector-java-headers
528
566
; ; NOTE "--- Static fields:" "--- Instance fields:" are for objects,
0 commit comments