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

[inspector] Introduce object view mode #271

Merged
merged 1 commit into from
May 14, 2024
Merged

Conversation

alexander-yakushev
Copy link
Member

@alexander-yakushev alexander-yakushev commented May 14, 2024

This is a feature that I've been wanting for a long long time. The idea is to have a toggle button (e.g. v) that forces inspector to render the current value as an unrecognized Java object – i.e., by displaying its fields.

image

image

image

This is very useful when working on Clojure itself or developing custom data structures that happen to implement List, Map, etc., but you want to see the implementation bits.

There are a couple of details I have not decided on yet:

  1. Originally, I wanted this to be a toggle (normal mode <-> java mode). However, this has a potential to add more view modes. I'm not sure which ones those would be right away, but I can possibly imagine something like simple mode (don't show metadata and datafy – for cases where those are too large and distract from viewing the value), a "pretty mode" that does uses pretty printing where currently there is a regular printer, etc.
  2. If there are more modes, then the "toggle" button can cycle through them. However, I don't think such cycling should be implemented on Orchard side, I think having a :view-mode as a plain config value is sufficient at this level. CIDER or cider-nrepl can then tackle user interactions (cycling, dedicated switches, both).
  3. I'm not set on the names of view modes (currently :normal and :java). Bikeshedding is welcome.

@alexander-yakushev alexander-yakushev marked this pull request as ready for review May 14, 2024 15:06
@alexander-yakushev alexander-yakushev force-pushed the view-mode branch 2 times, most recently from 716cbff to df1d0f7 Compare May 14, 2024 15:16
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.

Great addition - appreciated!

@alexander-yakushev alexander-yakushev changed the title [inspector] Introduce Java view mode [inspector] Introduce object view mode May 14, 2024
@alexander-yakushev
Copy link
Member Author

Renamed :java to :object – that probably makes more sense.

@bbatsov
Copy link
Member

bbatsov commented May 14, 2024

If there are more modes, then the "toggle" button can cycle through them. However, I don't think such cycling should be implemented on Orchard side, I think having a :view-mode as a plain config value is sufficient at this level. CIDER or cider-nrepl can then tackle user interactions (cycling, dedicated switches, both).

Agreed, that should be on the clients to implement.

I'm not set on the names of view modes (currently :normal and :java). Bikeshedding is welcome.

The :object name you chose makes sense to me. Something like raw could also work. I'm afraid I'm not particularly inspired with the names today.

@alexander-yakushev alexander-yakushev merged commit 59b5acf into master May 14, 2024
58 checks passed
@alexander-yakushev alexander-yakushev deleted the view-mode branch May 14, 2024 20:44
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.

3 participants