The Inspector Protocol
The inspector renders any value as a navigable, paginated tree. Its state lives on the server, in the nREPL session; the client only ever holds the latest rendering and issues navigation commands against the server-side state. One inspector exists per session.
Starting an Inspection
There is no inspect-start op. An inspection starts by riding along another
op:
-
eval - send a normal
evalmessage with a truthyinspectflag. The eval’s value is loaded into the session’s inspector and the response’svaluecontains the rendering (described below) instead of the printed value. -
exceptions -
cider/inspect-last-exception(aftercider/analyze-last-stacktrace) loads the exception cause atindex(withex-data "true", its ex-data) into the inspector. -
tap -
cider/tap-inspectloads a previously tapped value by itsidx. -
logs -
cider/log-inspect-eventloads a captured log event.
The Rendering Format
Every inspector op responds with:
| Key | Meaning |
|---|---|
|
The rendering: a string containing an EDN sequence the client must read. |
|
A string describing the navigation path from the root value to the
currently inspected one, e.g. |
|
|
The value string, once read, is a flat sequence of rendering directives:
-
a plain string - literal text to display;
-
[:newline]- a line break; -
[:value "printed-representation" idx]- a nested value the user can navigate into.idxis the integer to send back withcider/inspect-push(orcider/inspect-tap-indexed).
Rendering is thus entirely server-driven: the client displays the directives
in order, makes the [:value …] elements interactive, and never needs to
understand the inspected object itself.
Navigation and Actions
All ops below operate on the session’s current inspector and return the new rendering in the same format:
| Op | Params | Effect |
|---|---|---|
|
|
Descend into the nested value with that index. |
|
Go back up one level. |
|
|
Move to the next/previous element of the parent collection. |
|
|
Page through long collections. |
|
|
config (see below) |
Re-render the current value, optionally changing configuration. |
|
Cycle the view mode ( |
|
|
Toggle pretty-printing of rendered values. |
|
|
Compute and include an analytics section for the current object. |
|
|
|
Def the currently inspected value into a var. |
|
print options |
Stream the full printed value (as regular |
|
Send the current value to |
|
|
|
Send the nested value with that index to |
|
Reset the inspector state. |
Configuration
cider/inspect-refresh (and the initial eval + inspect message) accept
configuration keys that persist in the session’s inspector: page-size,
max-atom-length, max-coll-size, max-value-length, max-nested-depth,
pretty-print, sort-maps, only-diff, and view-mode. Boolean-ish
options are transmitted as the string "true".
The older cider/inspect-set-page-size, cider/inspect-set-max-atom-length,
cider/inspect-set-max-coll-size and cider/inspect-set-max-nested-depth
ops still work but are deprecated in favor of passing the corresponding
key to cider/inspect-refresh.