-
-
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
Refactor docsystem internals. #15266
Refactor docsystem internals. #15266
Conversation
println(io, "---\n") | ||
println(io, readstring(readme)) | ||
else | ||
println(io, "Additionally, no `README.md` found for module `", m, "`.\n") |
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.
what is this in addition to?
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.
It was in addition to the default no docs message that appears, but it's not really necessary so I've remove the "Additionally".
Aside from little nitpicks, this does look like a really nice simplification. The fewer things we have to implicitly import into base to make the docsystem work, the better, and 💯 for lazy parsing of the docstrings. |
942a6be
to
285a166
Compare
Thanks for reviewing @tkelman, I've pushed fixes for those comments. |
285a166
to
292a34d
Compare
Found and fixed an issue in Also added a small third commit that returns some extra metadata from |
|
||
# Modules | ||
function summarise(binding::Binding, sig) |
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.
Not sure the Americans will appreciate this name ;-)
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.
Yeah, probably not :( Will fix.
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.
Spellings changed in latest push.
CI failures were #15294, restarted
|
Structure of a module's `#meta` dict now has the following layout in all cases (with the exception of keywords): - each module's `#meta` `ObjectIdDict` has keys of type `Binding` and values of type `MultiDoc`. - each `MultiDoc` stores a collection of `DocStr` objects representing a single docstring each. These are ordered based on their order of definition rather than the current `type_morespecific` approach. - `DocStr`s store the raw text of a docstring and lazily parse this to a `Markdown.MD` object when requested. By not parsing every docstring we also make some space savings in the `sys.*` files. By keying `#meta` by `Binding` in every case the rest of the logic in `doc!` and `doc` becomes a lot more straightforward. `at-doc` expression building has also been simplified. Additionally, the "summaries" displayed when no documentation can be found have been refactored and simplified.
This takes advantage of the simplifications in the previous commit to reduce the complexity in this script. Outwardly the only difference should be the formatting of the summary that is displayed and speed (where timings drop from ~18 to ~9 seconds.)
This commit saves some of the values computed by `doc` and `summarise` into the generated `MD` object that is returned. These valus are the `Binding` and signature searched for, as well as the vector of `DocStr` objects that match the `Binding` and signature.
292a34d
to
1d851b2
Compare
Barring further comments, I'll merge this later on today. |
Refactor docsystem internals.
Custom docstring support was lost in JuliaLang#15266. This remedies the regressions introduced there as well as fixing `Text` and `HTML` display signatures that were also broken, likely when `Function` became an abstract type, and had gone unnoticed. Also adds a test case based on PyPlot to hopefully avoid future regressions. Fixes JuliaLang#15424.
Refactor docsystem internals
The first commit consists of the following changes:
Structure of a module's
#meta
dict now has the following layout in all cases (with the exception of keywords):#meta
ObjectIdDict
has keys of typeBinding
and values of typeMultiDoc
.MultiDoc
stores a collection ofDocStr
objects representing a single docstring each. These are ordered based on their order of definition rather than the currenttype_morespecific
approach.DocStr
s store the raw text of a docstring and lazily parse this to aMarkdown.MD
object when requested. By not parsing every docstring we also make some space savings in thesys.*
files.By keying
#meta
byBinding
in every case the rest of the logic indoc!
anddoc
becomes a lot more straightforward.at-doc
expression building has also been simplified.Additionally, the "summaries" displayed when no documentation can be found have been refactored and simplified.
Rewrite genstdlib.jl
The second commit takes advantage of the simplifications in the previous commit to reduce the complexity in this script. Outwardly the only difference should be the formatting of the summary that is displayed and speed (where timings drop from ~18 to ~9 seconds.)