summaryrefslogtreecommitdiff
path: root/cider-inspector.el
diff options
context:
space:
mode:
Diffstat (limited to 'cider-inspector.el')
-rw-r--r--cider-inspector.el27
1 files changed, 16 insertions, 11 deletions
diff --git a/cider-inspector.el b/cider-inspector.el
index 61d5007d..b1eddffb 100644
--- a/cider-inspector.el
+++ b/cider-inspector.el
@@ -1,7 +1,7 @@
;;; cider-inspector.el --- Object inspector -*- lexical-binding: t -*-
-;; Copyright © 2013-2018 Vital Reactor, LLC
-;; Copyright © 2014-2018 Bozhidar Batsov and CIDER contributors
+;; Copyright © 2013-2019 Vital Reactor, LLC
+;; Copyright © 2014-2019 Bozhidar Batsov and CIDER contributors
;; Author: Ian Eslick <ian@vitalreactor.com>
;; Bozhidar Batsov <bozhidar@batsov.com>
@@ -85,8 +85,7 @@ The page size can be also changed interactively within the inspector."
(set-syntax-table clojure-mode-syntax-table)
(setq-local electric-indent-chars nil)
(setq-local sesman-system 'CIDER)
- (when cider-special-mode-truncate-lines
- (setq-local truncate-lines t)))
+ (visual-line-mode 1))
;;;###autoload
(defun cider-inspect-last-sexp ()
@@ -134,6 +133,11 @@ This is used as an alternative to the built-in `last-command'. Whenever we
invoke any command through \\[execute-extended-command] and its variants,
the value of `last-command' is not set to the command it invokes.")
+(defvar cider-inspector--current-repl nil
+ "Contains the reference to the REPL where inspector was last invoked from.
+This is needed for internal inspector buffer operations (push,
+pop) to execute against the correct REPL session.")
+
;; Operations
;;;###autoload
(defun cider-inspect-expr (expr ns)
@@ -142,6 +146,7 @@ Interactively, EXPR is read from the minibuffer, and NS the
current buffer's namespace."
(interactive (list (cider-read-from-minibuffer "Inspect expression: " (cider-sexp-at-point))
(cider-current-ns)))
+ (setq cider-inspector--current-repl (cider-current-repl))
(when-let* ((value (cider-sync-request:inspect-expr expr ns (or cider-inspector-page-size 32))))
(cider-inspector--render-value value)))
@@ -197,39 +202,39 @@ Current page will be reset to zero."
(defun cider-sync-request:inspect-pop ()
"Move one level up in the inspector stack."
(thread-first '("op" "inspect-pop")
- (cider-nrepl-send-sync-request)
+ (cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))
(defun cider-sync-request:inspect-push (idx)
"Inspect the inside value specified by IDX."
(thread-first `("op" "inspect-push"
"idx" ,idx)
- (cider-nrepl-send-sync-request)
+ (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")
- (cider-nrepl-send-sync-request)
+ (cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))
(defun cider-sync-request:inspect-next-page ()
"Jump to the next page in paginated collection view."
(thread-first '("op" "inspect-next-page")
- (cider-nrepl-send-sync-request)
+ (cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))
(defun cider-sync-request:inspect-prev-page ()
"Jump to the previous page in paginated collection view."
(thread-first '("op" "inspect-prev-page")
- (cider-nrepl-send-sync-request)
+ (cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))
(defun cider-sync-request:inspect-set-page-size (page-size)
"Set the page size in paginated view to PAGE-SIZE."
(thread-first `("op" "inspect-set-page-size"
"page-size" ,page-size)
- (cider-nrepl-send-sync-request)
+ (cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))
(defun cider-sync-request:inspect-expr (expr ns page-size)
@@ -238,7 +243,7 @@ Set the page size in paginated view to PAGE-SIZE."
(thread-first (append (nrepl--eval-request expr ns)
`("inspect" "true"
"page-size" ,page-size))
- (cider-nrepl-send-sync-request)
+ (cider-nrepl-send-sync-request cider-inspector--current-repl)
(nrepl-dict-get "value")))
;; Render Inspector from Structured Values