Skip to content

Commit 1203129

Browse files
committed
Inspector: Introduce jump to previous/next sibling commands
Fixes #3529
1 parent 12ac771 commit 1203129

File tree

3 files changed

+59
-3
lines changed

3 files changed

+59
-3
lines changed

CHANGELOG.md

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

33
## master (unreleased)
44

5+
### New features
6+
7+
- [#3529](https://github.com/clojure-emacs/cider/issues/3529): CIDER inspector: introduce `cider-inspector-previous-sibling`, `cider-inspector-next-sibling` commands ([doc](https://docs.cider.mx/cider/debugging/inspector.html#usage)).
8+
59
### Changes
610

711
- [#3546](https://github.com/clojure-emacs/cider/issues/3546): Inspector: render Java items using `java-mode` syntax coloring.

cider-inspector.el

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ by clicking or navigating to them by other means."
113113
(define-key map "p" #'cider-inspector-previous-inspectable-object)
114114
(define-key map "f" #'forward-char)
115115
(define-key map "b" #'backward-char)
116+
(define-key map "9" #'cider-inspector-previous-sibling)
117+
(define-key map "0" #'cider-inspector-next-sibling)
116118
;; Emacs translates S-TAB to BACKTAB on X.
117119
(define-key map [backtab] #'cider-inspector-previous-inspectable-object)
118120
(easy-menu-define cider-inspector-mode-menu map
@@ -223,8 +225,27 @@ See `cider-sync-request:inspect-pop' and `cider-inspector--render-value'."
223225
(defun cider-inspector-push (idx)
224226
"Inspect the value at IDX in the inspector stack and render it.
225227
See `cider-sync-request:inspect-push' and `cider-inspector--render-value'"
226-
(push (point) cider-inspector-location-stack)
228+
(interactive)
227229
(when-let* ((value (cider-sync-request:inspect-push idx)))
230+
(push (point) cider-inspector-location-stack)
231+
(cider-inspector--render-value value)
232+
(cider-inspector-next-inspectable-object 1)))
233+
234+
(defun cider-inspector-previous-sibling ()
235+
"Inspect the previous sibling value within a sequential parent.
236+
See `cider-sync-request:inspect-previous-sibling' and `cider-inspector--render-value'"
237+
(interactive)
238+
(when-let* ((value (cider-sync-request:inspect-previous-sibling)))
239+
(push (point) cider-inspector-location-stack)
240+
(cider-inspector--render-value value)
241+
(cider-inspector-next-inspectable-object 1)))
242+
243+
(defun cider-inspector-next-sibling ()
244+
"Inspect the next sibling value within a sequential parent.
245+
See `cider-sync-request:inspect-next-sibling' and `cider-inspector--render-value'"
246+
(interactive)
247+
(when-let* ((value (cider-sync-request:inspect-next-sibling)))
248+
(push (point) cider-inspector-location-stack)
228249
(cider-inspector--render-value value)
229250
(cider-inspector-next-inspectable-object 1)))
230251

@@ -321,6 +342,18 @@ current-namespace."
321342
(cider-nrepl-send-sync-request cider-inspector--current-repl)
322343
(nrepl-dict-get "value")))
323344

345+
(defun cider-sync-request:inspect-previous-sibling ()
346+
"Inspect the previous sibling value within a sequential parent."
347+
(thread-first `("op" "inspect-previous-sibling")
348+
(cider-nrepl-send-sync-request cider-inspector--current-repl)
349+
(nrepl-dict-get "value")))
350+
351+
(defun cider-sync-request:inspect-next-sibling ()
352+
"Inspect the next sibling value within a sequential parent."
353+
(thread-first `("op" "inspect-next-sibling")
354+
(cider-nrepl-send-sync-request cider-inspector--current-repl)
355+
(nrepl-dict-get "value")))
356+
324357
(defun cider-sync-request:inspect-refresh ()
325358
"Re-render the currently inspected value."
326359
(thread-first '("op" "inspect-refresh")

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,40 +26,59 @@ You'll have access to additional keybindings in the inspector buffer
2626
(which is internally using `cider-inspector-mode`):
2727

2828
|===
29-
| Keyboard shortcut | Description
29+
| Keyboard shortcut | Command | Description
3030

31-
| kbd:[Tab] and kbd:[Shift-Tab] / kdb:[n] and kbd:[p]
31+
| kbd:[Tab] and kbd:[Shift-Tab] / kbd:[n] and kbd:[p]
32+
| `cider-inspector-next-inspectable-object`
3233
| Navigate inspectable sub-objects
3334

3435
| kbd:[f] and kbd:[b]
36+
| `forward-char`, `backward-char`
3537
| Navigate across characters on a line
3638

3739
| kbd:[Return]
40+
| `cider-inspector-operate-on-point`
3841
| Inspect sub-objects
3942

4043
| kbd:[l]
44+
| `cider-inspector-pop`
4145
| Pop to the parent object
4246

4347
| kbd:[g]
48+
| `cider-inspector-refresh`
4449
| Refresh the inspector (e.g. if viewing an atom/ref/agent)
4550

4651
| kbd:[SPC]
52+
| `cider-inspector-next-page`
4753
| Jump to next page in paginated view
4854

4955
| kbd:[M-SPC]
56+
| `cider-inspector-prev-page`
5057
| Jump to previous page in paginated view
5158

5259
| kbd:[s]
60+
| `cider-inspector-set-page-size`
5361
| Set a new page size in paginated view
5462

5563
| kbd:[c]
64+
| `cider-inspector-set-max-coll-size`
5665
| Set a new maximum size above which nested collections are truncated
5766

5867
| kbd:[a]
68+
| `cider-inspector-set-max-atom-length`
5969
| Set a new maximum length above which nested atoms (non-collections) are truncated
6070

6171
| kbd:[d]
72+
| `cider-inspector-def-current-val`
6273
| 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.
74+
75+
| kbd:[9]
76+
| `cider-inspector-previous-sibling`
77+
| Navigates to the previous sibling, within a sequential collection.
78+
79+
| kbd:[0]
80+
| `cider-inspector-next-sibling`
81+
| Navigates to the next sibling, within a sequential collection.
6382
|===
6483

6584
== Configuration

0 commit comments

Comments
 (0)