Skip to content

Commit 9be5e30

Browse files
cichlibbatsov
authored andcommitted
Add an op to clear the inspector's internal state
1 parent 4936b3c commit 9be5e30

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/cider/nrepl.clj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@
259259
{:doc "Sets the page size in paginated view to specified value."
260260
:requires {"page-size" "New page size."
261261
"session" "The current session"}
262+
:returns {"status" "\"done\""}}
263+
"inspect-clear"
264+
{:doc "Clears the state state of the inspector."
265+
:requires {"session" "The current session"}
262266
:returns {"status" "\"done\""}}}}))
263267

264268
(def-wrapper wrap-macroexpand cider.nrepl.middleware.macroexpand/handle-macroexpand

src/cider/nrepl/middleware/inspect.clj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@
8585
(defn set-page-size-reply [msg]
8686
(inspector-response msg (swap-inspector! msg inspect/set-page-size (:page-size msg))))
8787

88+
(defn clear-reply [msg]
89+
(inspector-response msg (swap-inspector! msg (constantly (inspect/fresh)))))
90+
8891
(defn handle-inspect [handler msg]
8992
(if (= (:op msg) "eval")
9093
(eval-reply handler msg)
@@ -96,4 +99,5 @@
9699
"inspect-get-path" get-path-reply
97100
"inspect-next-page" next-page-reply
98101
"inspect-prev-page" prev-page-reply
99-
"inspect-set-page-size" set-page-size-reply)))
102+
"inspect-set-page-size" set-page-size-reply
103+
"inspect-clear" clear-reply)))

0 commit comments

Comments
 (0)