clojure-emacs / orchard

A fertile ground for Clojure tooling
Eclipse Public License 1.0
326 stars 54 forks source link

[inspector] Prettify printed members when inspecting a class object #255

Closed alexander-yakushev closed 7 months ago

alexander-yakushev commented 7 months ago

Addresses #242.

alexander-yakushev commented 7 months ago

It's called prettify but the approach is not pretty. Anyway, at some point if we want more customizations it will have to be rewritten. But this should work for now.

I didn't replace the orchard.inspect representation for methods, fields, and such because, on its own, it is useful for a single method to show which class it belongs to. It's just that the inspector provides plenty of context when it renders many methods of the same class, so it makes sense to only override it there.

vemv commented 7 months ago

The prettification could also be applied when inspecting a Method

image

or Field:

image

(however if we do that then it's not clear that we're within the Long class. Maybe we could add an additional header?

alexander-yakushev commented 7 months ago

Just prettyfying the Value field can be easily done ad-hoc. Adding a header would require overloading inspect for methods and fields and constructors, then reusing the :default implementation which handles them now. I'd rather do the former. We can also render Value for them in some third specific way, e.g. java.lang.Long: public static int bitCount(long), but I'm not sure it would be any better than how it looks now.

vemv commented 7 months ago

Doing the prettification and nothing else is OK for now - in the end, the user knows what he's inspecting, or can go back if he forgot

I'd personally like the header but no rush - just leaving a discussion here is fine

vemv commented 7 months ago

java.lang.reflect.Field<java.lang.Long> or some other format can also be OK (assuming it doesn't affect navigation)