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

add new inspector function to tap current value #3549

Closed
wants to merge 11 commits into from

Conversation

behrica
Copy link
Contributor

@behrica behrica commented Oct 23, 2023

Fixes #3548

add new interactive function cider-inspector-tap-current-val to inspector.

It sends the current inspector value to the tap>.
It uses a new middleware op, inspect-tap-current-value which has been added recently to cider-nrepl.


Before submitting the PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):

  • [ x] The commits are consistent with our contribution guidelines
  • You've added tests (if possible) to cover your change(s)
  • All tests are passing (eldev test)
  • All code passes the linter (eldev lint) which is based on elisp-lint and includes
  • [x ] You've updated the changelog (if adding/changing user-visible functionality)
  • [ x] You've updated the user manual (if adding/changing user-visible functionality)

Copy link
Member

@vemv vemv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
cider-inspector.el Outdated Show resolved Hide resolved
@bbatsov
Copy link
Member

bbatsov commented Oct 24, 2023

Might be good to expand on this a bit in the debugging techniques/inspector part of the docs.

@behrica
Copy link
Contributor Author

behrica commented Oct 24, 2023

I added in docu a TIP to tap values from inspector in order to render them graphically using other tools.
This is at least my main use case.

@behrica
Copy link
Contributor Author

behrica commented Oct 24, 2023

I would have one more question on this PR.
My "initial use case" requires as well that the "tapped values" needed to be "transformed" by Clojure code before they get tapped.

This gets complicated by the fact, that the user would need to give "feedback" when this happens.

The example is "having a map deep in a value which represents 'vega-lite' data"
Clerk has a special vega-lite render, which can be "selected" by "wrapping" the value with some :meta before tapping it.
The point is that the user needed to be "asked" before tapping "what type of data" its is (= vega lite). Tihs cannot be inferred from the data as such.
Maybe this becomes more clear by look at an adhoc function I did for this purpose:
https://github.com/behrica/clerk-mode/blob/bff0aa274eae0923b6b0f3b64d32ab1fa3333c7f/clerk-mode.el#L80

We had as well a discussion on this here: #3311

Do you think the current code of this PR allows this easely, as an extension by using "advice" for example ?

@vemv
Copy link
Member

vemv commented Oct 24, 2023

I got these changed into 966cae4 preserving attribution.

Thanks much!

Do you think the current code of this PR allows this easely, as an extension by using "advice" for example ?

Probably not, but feel free to give it a try.

A clean solution would be to make the cider-nrepl accept a transformer function (fully-qualified symbol) - something like that?

Users could bind a specific key in the inspector map to perform cider-inspector-tap-current-val passing that extra argument.

Lastly, I dropped the path code, it turned out to excessively complicate things. It would be easier if cider-nrepl simply returned a (well-formed!) :path as part of every reponse that included a :value.

@vemv vemv closed this Oct 24, 2023
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

Successfully merging this pull request may close these issues.

add new function cider-inspector-tap-current-val
3 participants