Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inspect-get-path op not working as expected #826

Closed
behrica opened this issue Oct 24, 2023 · 2 comments
Closed

inspect-get-path op not working as expected #826

behrica opened this issue Oct 24, 2023 · 2 comments

Comments

@behrica
Copy link
Contributor

behrica commented Oct 24, 2023

I am in cider-inspector on a path printed as

--- Path:
  :foo :bar (nth 3)

and I call the middleware operation inspect-get-path

Expected behavior

I would expect that the operations returns the path
"similar" to what I see in inspector, which is : :foo :bar (nth 3)

but I get something different, which seems strange for 3 reasons:

  1. The path is returned as part of the "status", which seems weird
  2. the "order" is different "foo" "bar" "(nth 3)" vs "bar" "foo" "(nth 3)"
  3. I am inspecting a map, "{:foo {:bar [(+ 1 1) 4 5 6]}}" having keywords as keys, but the inspect-get-path op returns the strings as keys

I think the op is currently not used in CIDER in any case, correct ?
I though to use it eventualy here:
clojure-emacs/cider#3549
to get the "current path" instead of getting the current path from the textual result:
https://github.com/clojure-emacs/cider/blob/1090db8a677c2fb1b34aa5e0f591a99abcde3d5c/cider-inspector.el#L318

Actual behavior

(-->
  id         "273"
  op         "inspect-get-path"
  session    "df2d8ff3-6d3e-4819-ad37-605e64a7b58d"
  time-stamp "2023-10-24 17:50:07.849183027"
)
(<--
  id         "273"
  session    "df2d8ff3-6d3e-4819-ad37-605e64a7b58d"
  time-stamp "2023-10-24 17:50:07.850081483"
  status     ("done" "bar" "foo"
 ("nth" 3))
)

Steps to reproduce the problem

cider-inspect a map until the deepest point, the sequence

{:foo {:bar  [(+ 1 1) 4 5 6]}}

and then use an interactive function while in the inspector to call the inspect-get-path op:

(defun cider-inspector-get-path ()
  (interactive)
  (let ((status (thread-first `("op" "inspect-get-path")
                             (cider-nrepl-send-sync-request cider-inspector--current-repl)
                             (nrepl-dict-get "status"))))
    (message "Path: '%s'" (cdr status)))
  )

will print "Path: ’(bar foo (nth 0))’"
wile I would expect to see:

Path: ’(:foo :bar (nth 0))’
or have it returns outside "status" even.

Environment & Version information

cider-nrepl version

latest

Operating system

Linux

@vemv
Copy link
Member

vemv commented Oct 24, 2023

Thanks. I do not know much about this corner of cider-nrepl.

However, it comes to mind that we could include the :path in many Inspector responses (this time well-formed!) so that clients don't need to perform a separate request.

@vemv vemv mentioned this issue Apr 30, 2024
12 tasks
@vemv
Copy link
Member

vemv commented May 3, 2024

We're removing this op

* [#826](https://github.com/clojure-emacs/cider-nrepl/pull/826): Remove broken `inspect-get-path` middleware op, return path in every inspector middleware op instead.

@vemv vemv closed this as completed May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants