-
-
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] Unify inspector entrypoints #244
Conversation
Inspector object should not be nil, this should be ensured by the caller (e.g. cider-nrepl).
101250f
to
567c133
Compare
I agree that the current API is weird. That's mostly related to the fact that some parts of it are as old as
It's great you're pushing forward some efforts to clean up the codebase.
I'm around 99% sure |
src/orchard/inspect.clj
Outdated
:current-page 0, :rendered [], :indentation 0})) | ||
(def ^:private default-inspector-config | ||
"Default configuration values for the inspector." | ||
{:page-size 32 |
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.
In light of our previous conversation we might also add a couple of short comments explaining how the defaults were chosen.
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.
I will add comments to those where the default isn't completely arbitrary.
567c133
to
6a6fd0f
Compare
One more thought about this PR - perhaps it'd be even better to add a function called |
This makes sense, but we already have |
Fair enough. I didn't notice the existing |
I tried to make sense of all the ways to initiate a new inspection or re-inspection –
start
,fresh
,clear
. The problem with current state is that "an empty inspector" is not really a thing, it has to be inspecting something. So, an API call like(fresh)
doesn't really make sense. Also, reusing an inspector to inspect a new object (unrelated to the current one) actually means only reusing the dynamically changed config (page size, truncation limits, etc.); we don't want to reuse any part of the state.The updated API has
start
as the single entrypoint into an inspector. 1-arg takes a value to be inspected and returns a rendered inspector object. 2-arg takes a value and the config. An already existing inspector object can be passed as the config. There are no other legal ways to obtain a new inspector object besidesstart
.fresh
andclear
functions were retained and marked as deprecated in case somebody uses them.