branch: elpa/cider commit 1203129ba24aaa85b54914eebc96daf896229b22 Author: vemv <v...@users.noreply.github.com> Commit: vemv <v...@users.noreply.github.com>
Inspector: Introduce jump to previous/next sibling commands Fixes https://github.com/clojure-emacs/cider/issues/3529 --- CHANGELOG.md | 4 +++ cider-inspector.el | 35 ++++++++++++++++++++++++- doc/modules/ROOT/pages/debugging/inspector.adoc | 23 ++++++++++++++-- 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ecbb5cb992..dbf1dfe035 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## master (unreleased) +### New features + +- [#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)). + ### Changes - [#3546](https://github.com/clojure-emacs/cider/issues/3546): Inspector: render Java items using `java-mode` syntax coloring. diff --git a/cider-inspector.el b/cider-inspector.el index ef538faa6e..fedca2e496 100644 --- a/cider-inspector.el +++ b/cider-inspector.el @@ -113,6 +113,8 @@ by clicking or navigating to them by other means." (define-key map "p" #'cider-inspector-previous-inspectable-object) (define-key map "f" #'forward-char) (define-key map "b" #'backward-char) + (define-key map "9" #'cider-inspector-previous-sibling) + (define-key map "0" #'cider-inspector-next-sibling) ;; Emacs translates S-TAB to BACKTAB on X. (define-key map [backtab] #'cider-inspector-previous-inspectable-object) (easy-menu-define cider-inspector-mode-menu map @@ -223,8 +225,27 @@ See `cider-sync-request:inspect-pop' and `cider-inspector--render-value'." (defun cider-inspector-push (idx) "Inspect the value at IDX in the inspector stack and render it. See `cider-sync-request:inspect-push' and `cider-inspector--render-value'" - (push (point) cider-inspector-location-stack) + (interactive) (when-let* ((value (cider-sync-request:inspect-push idx))) + (push (point) cider-inspector-location-stack) + (cider-inspector--render-value value) + (cider-inspector-next-inspectable-object 1))) + +(defun cider-inspector-previous-sibling () + "Inspect the previous sibling value within a sequential parent. +See `cider-sync-request:inspect-previous-sibling' and `cider-inspector--render-value'" + (interactive) + (when-let* ((value (cider-sync-request:inspect-previous-sibling))) + (push (point) cider-inspector-location-stack) + (cider-inspector--render-value value) + (cider-inspector-next-inspectable-object 1))) + +(defun cider-inspector-next-sibling () + "Inspect the next sibling value within a sequential parent. +See `cider-sync-request:inspect-next-sibling' and `cider-inspector--render-value'" + (interactive) + (when-let* ((value (cider-sync-request:inspect-next-sibling))) + (push (point) cider-inspector-location-stack) (cider-inspector--render-value value) (cider-inspector-next-inspectable-object 1))) @@ -321,6 +342,18 @@ current-namespace." (cider-nrepl-send-sync-request cider-inspector--current-repl) (nrepl-dict-get "value"))) +(defun cider-sync-request:inspect-previous-sibling () + "Inspect the previous sibling value within a sequential parent." + (thread-first `("op" "inspect-previous-sibling") + (cider-nrepl-send-sync-request cider-inspector--current-repl) + (nrepl-dict-get "value"))) + +(defun cider-sync-request:inspect-next-sibling () + "Inspect the next sibling value within a sequential parent." + (thread-first `("op" "inspect-next-sibling") + (cider-nrepl-send-sync-request cider-inspector--current-repl) + (nrepl-dict-get "value"))) + (defun cider-sync-request:inspect-refresh () "Re-render the currently inspected value." (thread-first '("op" "inspect-refresh") diff --git a/doc/modules/ROOT/pages/debugging/inspector.adoc b/doc/modules/ROOT/pages/debugging/inspector.adoc index 3a6509afa2..400e22d4e1 100644 --- a/doc/modules/ROOT/pages/debugging/inspector.adoc +++ b/doc/modules/ROOT/pages/debugging/inspector.adoc @@ -26,40 +26,59 @@ You'll have access to additional keybindings in the inspector buffer (which is internally using `cider-inspector-mode`): |=== -| Keyboard shortcut | Description +| Keyboard shortcut | Command | Description -| kbd:[Tab] and kbd:[Shift-Tab] / kdb:[n] and kbd:[p] +| kbd:[Tab] and kbd:[Shift-Tab] / kbd:[n] and kbd:[p] +| `cider-inspector-next-inspectable-object` | Navigate inspectable sub-objects | kbd:[f] and kbd:[b] +| `forward-char`, `backward-char` | Navigate across characters on a line | kbd:[Return] +| `cider-inspector-operate-on-point` | Inspect sub-objects | kbd:[l] +| `cider-inspector-pop` | Pop to the parent object | kbd:[g] +| `cider-inspector-refresh` | Refresh the inspector (e.g. if viewing an atom/ref/agent) | kbd:[SPC] +| `cider-inspector-next-page` | Jump to next page in paginated view | kbd:[M-SPC] +| `cider-inspector-prev-page` | Jump to previous page in paginated view | kbd:[s] +| `cider-inspector-set-page-size` | Set a new page size in paginated view | kbd:[c] +| `cider-inspector-set-max-coll-size` | Set a new maximum size above which nested collections are truncated | kbd:[a] +| `cider-inspector-set-max-atom-length` | Set a new maximum length above which nested atoms (non-collections) are truncated | kbd:[d] +| `cider-inspector-def-current-val` | 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. + +| kbd:[9] +| `cider-inspector-previous-sibling` +| Navigates to the previous sibling, within a sequential collection. + +| kbd:[0] +| `cider-inspector-next-sibling` +| Navigates to the next sibling, within a sequential collection. |=== == Configuration