-
-
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
Change signatures that help is showing (revive #25672, fix #20064) #29102
Conversation
Since this fixes a regression/bug introduced in 0.7, can this be backported to 1.0? |
stdlib/REPL/src/docview.jl
Outdated
# Lookup `binding` and `sig` for matches in all modules of the docsystem. | ||
for mod in modules | ||
dict = meta(mod) | ||
if haskey(dict, binding) | ||
multidoc = dict[binding] | ||
push!(groups, multidoc) | ||
for msig in multidoc.order | ||
sig <: msig && push!(results, multidoc.docs[msig]) | ||
if typeintersect(msig, sig) != Union{} | ||
#if (isconcretetype(sig) && sig <: msig) || (!isconcretetype(sig) && msig <: sig) || sig == Union{} |
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.
Delete?
I'm not super comfortable putting this straight into 1.0.1. It has had little testing and I am not sure exactly what effects it will have when it comes to rendered docs. Feels better to have this live on master for a while first. |
One thing that would be good is to render the docs with and without this PR and diff them. |
b79d0d2
to
9932db7
Compare
Thanks for your feedback @KristofferC. You are right about the backporting. It has not been tested enough in the wild. By diffing them, do you mean posting here the different output as you did in #25672? |
@KristofferC I added the diff at the top. |
Thanks, but what I meant was more along the lines of rendering the HTML documentation with this PR and without and then looking at the diff between them to see the effect on a more large scale, than just a toy example. |
In the documentation source it reads help?> pairs
search: pairs uppercasefirst Pair partialsort partialsort! partialsortperm partialsortperm! PartialQuickSort
pairs(collection)
Return an iterator over key => value pairs for any collection that maps a set of keys to a set of values. This includes arrays, where the keys are the array indices.
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
pairs(IndexLinear(), A)
pairs(IndexCartesian(), A)
pairs(IndexStyle(A), A)
An iterator that accesses each element of the array A, returning i => x, where i is the index for the element and x = A[i]. Identical to pairs(A), except that the style of index can be selected. Also similar to
enumerate(A), except i will be a valid index for A, while enumerate always counts from 1 regardless of the indices of A.
Specifying IndexLinear() ensures that i will be an integer; specifying IndexCartesian() ensures that i will be a CartesianIndex; specifying IndexStyle(A) chooses whichever has been defined as the native indexing style for
array A.
Mutation of the bounds of the underlying array will invalidate this iterator.
Examples
≡≡≡≡≡≡≡≡≡≡
julia> A = ["a" "d"; "b" "e"; "c" "f"];
julia> for (index, value) in pairs(IndexStyle(A), A)
println("$index $value")
end
1 a
2 b
3 c
4 d
5 e
6 f
julia> S = view(A, 1:2, :);
julia> for (index, value) in pairs(IndexStyle(S), S)
println("$index $value")
end
CartesianIndex(1, 1) a
CartesianIndex(2, 1) b
CartesianIndex(1, 2) d
CartesianIndex(2, 2) e
See also: IndexStyle, axes. |
I guss we have to apply the change also here: Actually, I don't know why the Documenter output should be different at all. It seems that Documenter is collecting the docstrings itself and is not calling |
I didn't know this was only for repl use, I thought Documenter used this as well to extract what docstrings to show in the rendered documentation. |
@thofma I am not actually very familiar the docsystem code in Documenter, but as a general principle, Documenter should behave similarly to the REPL I'd say. If there is / will be a difference between them, please do open an issue in Documenter for this. Or if you'd willing to PR the fix, that would be even more awesome. Also, if we can offload as much of the docsystem logic to Base, instead of duplicating it in Documenter, that would be good too. There's maybe a reason why Documenter does not use |
I tried to investigate why the built documentation looks different with this PR (it really should not since Documenter does its own thing and is not affected by the changes here). But whenever I tried to debug it using some print statements in Documenter, it gave me the correct result. I think I am hitting some weird bug. I will look at Documenter. |
9932db7
to
c409508
Compare
@KristofferC Rebased and the bug is gone. Documenation built is not affected. This PR here only affects the REPL helpmode and nothing else, which is explained in the OP and covered by tests. Is there something else that needs to be addressed? |
Friendly bump |
The issue persists with latest master, so again a friendly bump. |
This is a rebased version of #25672, which fixes the regression noticed in #20064.
I hope you don't mind @KristofferC
I used the check suggested by Jameson and added tests.
Here is the old and new behavior
1.0/master
This PR
Consider
1.0/master
This PR
Should be squashed when merged.