Skip to content

Commit

Permalink
[inspect] Remove broken inspect-get-path op, provide path in inspecto…
Browse files Browse the repository at this point in the history
…r reply instead

See #826.
  • Loading branch information
alexander-yakushev committed Apr 30, 2024
1 parent 1e51d18 commit 1deeb9c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 32 deletions.
20 changes: 0 additions & 20 deletions doc/modules/ROOT/pages/nrepl-api/ops.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -524,26 +524,6 @@ Returns::



=== `inspect-get-path`

Returns the path to the current position in the inspected value.

Required parameters::
* `:session` The current session


Optional parameters::
{blank}

Returns::
* `:doc-block-tags-fragments` May be absent. Represent the 'param', 'returns' and 'throws' sections a Java doc comment. It's a vector of fragments, where fragment is a map with ``:type`` ('text' or 'html') and ``:content`` plain text or html markup, respectively
* `:doc-first-sentence-fragments` May be absent. Represents the first sentence of a Java doc comment. It's a vector of fragments, where fragment is a map with ``:type`` ('text' or 'html') and ``:content`` plain text or html markup, respectively
* `:doc-fragments` May be absent. Represents the body of a Java doc comment, including the first sentence and excluding any block tags. It's a vector of fragments, where fragment is a map with ``:type`` ('text' or 'html') and ``:content`` plain text or html markup, respectively
* `:status` "done"
* `:value` The inspector result. Contains a specially-formatted string that can be ``read`` and then rendered client-side.



=== `inspect-last-exception`

Returns an Inspector response for the last exception that has been processed through ``analyze-last-stacktrace`` for the current nrepl session.
Expand Down
2 changes: 1 addition & 1 deletion doc/modules/ROOT/pages/nrepl-api/supplied_middleware.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
| `wrap-inspect`
| -
| No
| `inspect-(start/refresh/pop/push/reset/get-path)`
| `inspect-(start/refresh/pop/push)`
| Inspect a Clojure expression.

| `wrap-log`
Expand Down
4 changes: 0 additions & 4 deletions src/cider/nrepl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,6 @@ if applicable, and re-render the updated value."
{:doc "Re-renders the currently inspected value."
:requires {"session" "The current session"}
:returns inspector-returns}
"inspect-get-path"
{:doc "Returns the path to the current position in the inspected value."
:requires {"session" "The current session"}
:returns inspector-returns}
"inspect-next-page"
{:doc "Jumps to the next page in paginated collection view."
:requires {"session" "The current session"}
Expand Down
11 changes: 4 additions & 7 deletions src/cider/nrepl/middleware/inspect.clj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
([msg inspector]
(inspector-response msg inspector {:status :done}))

([msg {:keys [rendered value]} resp]
([msg {:keys [rendered value path]} resp]
(let [class-sym (when (class? value)
(-> ^Class value .getCanonicalName symbol))
method-sym (when (instance? java.lang.reflect.Method value)
Expand All @@ -45,8 +45,9 @@
[:doc-fragments
:doc-first-sentence-fragments
:doc-block-tags-fragments]))
{:value (binding [*print-length* nil]
(pr-str rendered))})))))
(binding [*print-length* nil]
{:value (pr-str (seq rendered))
:path (pr-str (seq path))}))))))

(defn- warmup-javadoc-cache [^Class clazz]
(when-let [class-sym (some-> clazz .getCanonicalName symbol)]
Expand Down Expand Up @@ -127,9 +128,6 @@
inspect/inspect-render)
(inspect/fresh)))))

(defn get-path-reply [{:keys [session]}]
(get-in (meta session) [::inspector :path]))

(defn next-page-reply [msg]
(inspector-response msg (swap-inspector! msg inspect/next-page)))

Expand Down Expand Up @@ -173,7 +171,6 @@
"inspect-next-sibling" next-sibling-reply
"inspect-previous-sibling" previous-sibling-reply
"inspect-refresh" refresh-reply
"inspect-get-path" get-path-reply
"inspect-next-page" next-page-reply
"inspect-prev-page" prev-page-reply
"inspect-set-page-size" set-page-size-reply
Expand Down

0 comments on commit 1deeb9c

Please sign in to comment.