Skip to content

Commit 797b6b9

Browse files
[inspector] Add function and binding for toggling view mode
1 parent f4bb3f2 commit 797b6b9

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### New features
66

7+
- [#3692](https://github.com/clojure-emacs/cider/pull/3692): Add ability to switch view modes in the ispector (bound to `v`).
8+
79
### Changes
810

911
- Bump the injected `cider-nrepl` to [0.49.0](https://github.com/clojure-emacs/cider-nrepl/blob/master/CHANGELOG.md#0490-2024-06-02).

cider-inspector.el

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ by clicking or navigating to them by other means."
124124
(define-key map "a" #'cider-inspector-set-max-atom-length)
125125
(define-key map "c" #'cider-inspector-set-max-coll-size)
126126
(define-key map "C" #'cider-inspector-set-max-nested-depth)
127+
(define-key map "v" #'cider-inspector-toggle-view-mode)
127128
(define-key map "d" #'cider-inspector-def-current-val)
128129
(define-key map "t" #'cider-inspector-tap-current-val)
129130
(define-key map "1" #'cider-inspector-tap-at-point)
@@ -353,6 +354,14 @@ MAX-NESTED-DEPTH is the new value."
353354
(when (nrepl-dict-get result "value")
354355
(cider-inspector--render-value result 'v2))))
355356

357+
(defun cider-inspector-toggle-view-mode ()
358+
"Toggle the view mode of the inspector between normal and object view mode."
359+
(interactive)
360+
(let ((result (cider-nrepl-send-sync-request `("op" "inspect-toggle-view-mode")
361+
cider-inspector--current-repl)))
362+
(when (nrepl-dict-get result "value")
363+
(cider-inspector--render-value result 'v2))))
364+
356365
(defcustom cider-inspector-preferred-var-names nil
357366
"The preferred var names to be suggested by `cider-inspector-def-current-val'.
358367

doc/modules/ROOT/pages/debugging/inspector.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ You'll have access to additional keybindings in the inspector buffer
7676
| `cider-inspector-set-max-atom-length`
7777
| Set a new maximum length above which nested atoms (non-collections) are truncated
7878

79+
| kbd:[v]
80+
| `cider-inspector-toggle-view-mode`
81+
| Switch the rendering of the current value between `:normal` and `:object` view mode.
82+
7983
| kbd:[d]
8084
| `cider-inspector-def-current-val`
8185
| Defines a var in the REPL namespace with current inspector value. If you tend to always choose the same name(s), you may want to set the `cider-inspector-preferred-var-names` customization option.

0 commit comments

Comments
 (0)