-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Create show_supertypes function #21443
Conversation
Maybe part of the |
992c442
to
d24238d
Compare
Added
|
Additionally, limited the number of displayed subtypes in the type help:
|
base/docs/Docs.jl
Outdated
@@ -395,9 +395,18 @@ function summarize(io::IO, T::DataType, binding) | |||
if !isempty(subtypes(T)) | |||
println(io, "**Subtypes:**") | |||
println(io, "```") | |||
for t in subtypes(T) | |||
sub_types = subtypes(T) | |||
for t in Iterators.take(sub_types, 20) |
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.
do we hardcode limits like this elsewhere? could maybe be an iocontext property eventually
f6825e9
to
2478f29
Compare
I removed the limiting the amount of show subtypes in the help. I'll make another PR for that. |
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.
Nice, I like it. 👍
@@ -400,6 +400,13 @@ function summarize(io::IO, T::DataType, binding) | |||
end | |||
println(io, "```") | |||
end | |||
if supertype(T) != Any | |||
println(io, "**Supertype Hierarchy:**") |
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.
should these both be capitalized?
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 prefer using title case for headings
I'll merge this later today unless there are objections. |
It's a little sad that this is disabled if the type is documented. Is there a way we can get this into help regardless of whether the type is documented? |
Personally, I'm in favor of more complete automatic help output for things, including supertypes for types and methods for functions. |
That's exactly what's causing #20904 though.... |
Yes, well, there are more direct ways to fix that bug than just avoiding triggering it. |
Ture. What I'm trying to say is that the automatically generated doc isn't very helpful sometimes and it should be possible to manually write documents that are much better. OTOH though for this particular case, the super type list is likely short so including this unconditionally might be acceptable. |
A colleague of mine wanted to visualize the type hierarchy so I came up with this. I would like to potentially work it into
show
itself but I was unsure how I should integrate this.