-
-
Notifications
You must be signed in to change notification settings - Fork 54
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] Configure truncation limits #111
Conversation
bf6a4cd
to
e3e7502
Compare
The limits after which the inspector truncates collection members are now configurable. Previously they were hardcoded to 5 and 150 for collection and atom (non-collection) members.
e3e7502
to
d30d148
Compare
(defn- short? [coll] | ||
(<= (count coll) 5)) | ||
(def ^:private ^:dynamic *max-atom-length* 150) | ||
(def ^:private ^:dynamic *max-coll-size* 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is one size and the other length?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah I think these names are a sign of my java heritage, and am happy to adjust them if needed. I started with max-string-length and max-coll-count, but "count" sounded weird to me because it's more about "how much of this collection do I want to see" vs what could be taken as "how many collections do I want to see". It turned out "string" was too specific, so it became max-atom-length
, and java collections have sizes, so I ended up with max-coll-size
.
Later on, I realized it's really more like max-branching-factor
, and that it would be cool, if instead of having to set it manually, I could just tell inspector how much data I want to see, and have it go figure reasonable depths and breadths on a per-node basis. That'd be for another time though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming is hard. :-) Thanks for explaining your reasoning. It makes sense to me.
Great idea. Overall the change seems solid to me. For a while it had bothered me that those were hardcoded and it's nice that we're finally fixing this. |
I wonder if it's better to make the dynamic vars public instead- that way Orchard doesn't have to expose a setter API, and cider-nrepl can |
I thought about this myself, but I see @pdbrown just followed the existing patterns in the code. The inspector has a very messy history as it's a direct descendant of the oldest code from I'm fine with using dyn vars for configuration, but I like to give people some cleaner alternative as well. E.g. in nREPL's |
Yeah that's basically it. I guess I thought it was nice to keep the inspector's configuration together on the "inspector state" and then keep the dynamic scope as small as possible, so then we can do this: https://github.com/clojure-emacs/cider-nrepl/pull/694/files#diff-2d94dd0e5df3764b260b1bf0208d491c564b44a95f47aa0678d7046c7fd0d754R28 |
Thanks! I'll cut a new release soon. |
I just noticed that inspect-value for |
Ah yeah, I noticed |
Yeah, I always thought it was a bug to have maps suddenly display fewer items the more you add to them. 0. { :a 1, :b 2, :c 3 }
1. { :a 1, :b 2, :c 3, :d 4 }
2. { :a 1, :b 2, :c 3, :d 4, :e 5 }
3. { :a 1, ... }
4. { :a 1, ... } And it's usually not the one key/val I'm interested in either - I have another experiment in prioritizing/ordering keys but that's for another time. @bbatsov unless you want to group related inspector changes together for a release? I can put up a draft PR of that. |
The limits after which the inspector truncates collection members are now
configurable. Previously they were hardcoded to 5 and 150 for collection and
atom (non-collection) members.
Hi there!
I've been using cider-inspect to great effect recently. Occasionally, I run into cases where it would be really nice to see a collection like:
but it currently appears as:
and I have to nav into each element one by one.
This change, and 2 more like it in cider-nrepl and cider, make the nested collection size limit configurable. While I was at it, I figured I might as well make the non-collection "atom" member sizes configurable too.