Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new inspector function to tap current value #3549

Closed
wants to merge 11 commits into from
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
### Changes

- [#3546](https://github.com/clojure-emacs/cider/issues/3546): Inspector: render Java items using `java-mode` syntax coloring.
- [#3548](https://github.com/clojure-emacs/cider/issues/3548)
Inspector: add function to tap> the current inspector value
behrica marked this conversation as resolved.
Show resolved Hide resolved

### Bugs fixed

Expand Down
14 changes: 14 additions & 0 deletions cider-inspector.el
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,14 @@ current-namespace."
(cider-inspector--render-value value)
(message "%s#'%s/%s = %s" cider-eval-result-prefix ns var-name value)))

(defun cider-inspector-tap-current-val ()
"Sends current value to tap>."
(interactive)
(setq cider-inspector--current-repl (cider-current-repl))
(when-let* ((value (cider-sync-request:inspect-tap-current-val)))
(cider-inspector--render-value value)
(message "%s# tapped %s" cider-eval-result-prefix value)))
behrica marked this conversation as resolved.
Show resolved Hide resolved

;; nREPL interactions
(defun cider-sync-request:inspect-pop ()
"Move one level up in the inspector stack."
Expand Down Expand Up @@ -369,6 +377,12 @@ MAX-SIZE is the new value."
(cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))

(defun cider-sync-request:inspect-tap-current-val ()
"Sends current inspector value to tap>."
(thread-first `("op" "inspect-tap-current-value")
(cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))

(defun cider-sync-request:inspect-expr (expr ns page-size max-atom-length max-coll-size)
"Evaluate EXPR in context of NS and inspect its result.
Set the page size in paginated view to PAGE-SIZE, maximum length of atomic
Expand Down
4 changes: 4 additions & 0 deletions doc/modules/ROOT/pages/debugging/inspector.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ You'll have access to additional keybindings in the inspector buffer

| kbd:[d]
| 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:[t]
behrica marked this conversation as resolved.
Show resolved Hide resolved
| Sends the current inspector value to Clojure's tap>.

|===

== Configuration
Expand Down
Loading