Inspector
The value inspector allows you to inspect and navigate the structure of data. While you can use it for pretty much anything (e.g. primitive data types, var, ref types) it’s most useful when you’re dealing with (deeply) nested collection-like data types (e.g. a vector of maps).
Usage
Typing C-c M-i (cider-inspect
) after some form in a source
buffer or the REPL will show you the structure of the form’s result
in a new buffer. You can also use C-u C-c M-i to inspect
the result of the current top-level form and C-u C-u C-c M-i to
read an expression from the minibuffer and inspect its result.
Alternatively, after a regular eval command, you can inspect the last
evaluated value using cider-inspect-last-result
. When an inspector
buffer is visible in the background, it is automatically updated with
the last result. This behavior can be controlled with the variable
cider-auto-inspect-after-eval
.
The inspector can also be invoked in the middle of a debugging session, see here for more details. |
The current value of the debugger can be as sent as well to Clojure’s
tap> facility. This can be used to integrate CIDER with various external
tools which render tapped values in a web browser, for example.
|
You’ll have access to additional keybindings in the inspector buffer
(which is internally using cider-inspector-mode
):
Keyboard shortcut | Command | Description |
---|---|---|
Tab and Shift-Tab / n and p |
|
Navigate inspectable sub-objects |
f and b |
|
Navigate across characters on a line |
Return |
|
Inspect sub-objects |
l |
|
Pop to the parent object |
g |
|
Refresh the inspector (e.g. if viewing an atom/ref/agent) |
SPC or Next |
|
Jump to next page in paginated view |
M-SPC or Prev |
|
Jump to previous page in paginated view |
s |
|
Set a new page size in paginated view |
c |
|
Set a new maximum size above which nested collections are truncated |
C |
`cider-inspector-set-max-nested-depth |
Set a new maximum nesting level above which the collections are truncated |
a |
|
Set a new maximum length above which nested atoms (non-collections) are truncated |
v |
|
Switch the rendering of the current value between |
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 |
9 |
|
Navigates to the previous sibling, within a sequential collection. |
0 |
|
Navigates to the next sibling, within a sequential collection. |
o |
|
Opens the url or file at point, if found. |
: |
|
Prompts for a new value, rendering it in the Inspector. |
t |
|
Performs |
1 |
|
Performs |
Use enrich-classpath
for best results
If enrich-classpath is activated, inspecting a Java class, method or field will richly display its Java doc comment documentation at the bottom of the inspector.
Configuration
By default, navigation skips over values like nils, numbers and
keywords, which are not interesting to inspect. You can control this
behavior using the variable cider-inspector-skip-uninteresting
.
The inspector buffer is automatically selected by default. You
can disable the auto selection with the variable
cider-inspector-auto-select-buffer
.
You can set the amount of data shown by default with the variables
cider-inspector-page-size
, cider-inspector-max-coll-size
,
cider-inspector-max-nested-depth
, and cider-inspector-max-atom-length
. The
values can be adjusted for the current inspector buffer using the keybidings
listed in the table above.
If you enable cider-inspector-fill-frame
, the inspector window fills its
frame.
When you define a var using d, a var name can be suggested (default none).
You can customize this value via the cider-inspector-preferred-var-names
configuration option. Even after setting it, you are free to choose new names on
the fly, as you type. Most recent names will take priority in subsequent usages.