Skip to content

Commit 2ca125f

Browse files
authored
docs: show binding name for No documentation found for ... message (#57093)
Making it more informative. E.g., the difference for `help?> Base._wait` is: ```diff diff --git a/old b/new index 87f9b2d43a..5fb065658a 100644 --- a/old +++ b/new @@ -5,7 +5,7 @@ │ │ • `Base._wait` - No documentation found for private symbol. + No documentation found for private binding `Base._wait`. `Base._wait` is a `Function`. ```
1 parent cbc47c9 commit 2ca125f

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

stdlib/REPL/src/docview.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,11 @@ function summarize(binding::Binding, sig)
301301
if defined(binding)
302302
binding_res = resolve(binding)
303303
if !isa(binding_res, Module)
304+
varstr = "$(binding.mod).$(binding.var)"
304305
if Base.ispublic(binding.mod, binding.var)
305-
println(io, "No documentation found for public symbol.\n")
306+
println(io, "No documentation found for public binding `$varstr`.\n")
306307
else
307-
println(io, "No documentation found for private symbol.\n")
308+
println(io, "No documentation found for private binding `$varstr`.\n")
308309
end
309310
end
310311
summarize(io, binding_res, binding)

test/docs.jl

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -684,9 +684,11 @@ end
684684
@doc "This should document @m1... since its the result of expansion" @m2_11993
685685
@test (@doc @m1_11993) !== nothing
686686
let d = (@doc :@m2_11993),
687-
macro_doc = Markdown.parse("`$(curmod_prefix == "Main." ? "" : curmod_prefix)@m2_11993` is a macro.")
687+
varstr = "$(curmod_prefix == "Main." ? "" : curmod_prefix)@m2_11993"
688+
docstr = Markdown.Code("", "$curmod_prefix@m2_11993")
689+
macro_doc = Markdown.parse("`$varstr` is a macro.")
688690
@test docstring_startswith(d, doc"""
689-
No documentation found for private symbol.
691+
No documentation found for private binding $docstr.
690692
691693
$macro_doc""")
692694
end
@@ -901,7 +903,7 @@ Binding `$(curmod_prefix)Undocumented.bindingdoesnotexist` does not exist.
901903
@test docstrings_equal(@doc(Undocumented.bindingdoesnotexist), doc"$doc_str")
902904

903905
doc_str = Markdown.parse("""
904-
No documentation found for public symbol.
906+
No documentation found for public binding `$(curmod_prefix)Undocumented.A`.
905907
906908
# Summary
907909
```
@@ -917,7 +919,7 @@ $(curmod_prefix)Undocumented.C
917919
@test docstrings_equal(@doc(Undocumented.A), doc"$doc_str")
918920

919921
doc_str = Markdown.parse("""
920-
No documentation found for public symbol.
922+
No documentation found for public binding `$(curmod_prefix)Undocumented.B`.
921923
922924
# Summary
923925
```
@@ -937,7 +939,7 @@ $(curmod_prefix)Undocumented.B <: $(curmod_prefix)Undocumented.A <: Any
937939
@test docstrings_equal(@doc(Undocumented.B), doc"$doc_str")
938940

939941
doc_str = Markdown.parse("""
940-
No documentation found for public symbol.
942+
No documentation found for public binding `$(curmod_prefix)Undocumented.C`.
941943
942944
# Summary
943945
```
@@ -952,7 +954,7 @@ $(curmod_prefix)Undocumented.C <: $(curmod_prefix)Undocumented.A <: Any
952954
@test docstrings_equal(@doc(Undocumented.C), doc"$doc_str")
953955

954956
doc_str = Markdown.parse("""
955-
No documentation found for private symbol.
957+
No documentation found for private binding `$(curmod_prefix)Undocumented.D`.
956958
957959
# Summary
958960
```
@@ -974,7 +976,7 @@ $(curmod_prefix)Undocumented.D <: $(curmod_prefix)Undocumented.B <: $(curmod_pre
974976
@test docstrings_equal(@doc(Undocumented.D), doc"$doc_str")
975977

976978
doc_str = Markdown.parse("""
977-
No documentation found for public symbol.
979+
No documentation found for public binding `$(curmod_prefix)Undocumented.at0`.
978980
979981
# Summary
980982
@@ -994,7 +996,7 @@ $(curmod_prefix)Undocumented.st4{T<:Number, N}
994996
@test docstrings_equal(@doc(Undocumented.at0), doc"$doc_str")
995997

996998
doc_str = Markdown.parse("""
997-
No documentation found for private symbol.
999+
No documentation found for private binding `$(curmod_prefix)Undocumented.at1`.
9981000
9991001
# Summary
10001002
@@ -1017,7 +1019,7 @@ $(curmod_prefix)Undocumented.at1{T>:Integer, N} <: $(curmod_prefix)Undocumented.
10171019
@test docstrings_equal(@doc(Undocumented.at1), doc"$doc_str")
10181020

10191021
doc_str = Markdown.parse("""
1020-
No documentation found for private symbol.
1022+
No documentation found for private binding `$(curmod_prefix)Undocumented.at_`.
10211023
10221024
# Summary
10231025
@@ -1036,7 +1038,7 @@ $(curmod_prefix)Undocumented.st4{Int64, N}
10361038
@test docstrings_equal(@doc(Undocumented.at_), doc"$doc_str")
10371039

10381040
doc_str = Markdown.parse("""
1039-
No documentation found for public symbol.
1041+
No documentation found for public binding `$(curmod_prefix)Undocumented.pt2`.
10401042
10411043
# Summary
10421044
@@ -1053,7 +1055,7 @@ $(curmod_prefix)Undocumented.pt2{T<:Number, N, A>:Integer} <: $(curmod_prefix)Un
10531055
@test docstrings_equal(@doc(Undocumented.pt2), doc"$doc_str")
10541056

10551057
doc_str = Markdown.parse("""
1056-
No documentation found for private symbol.
1058+
No documentation found for private binding `$(curmod_prefix)Undocumented.st3`.
10571059
10581060
# Summary
10591061
@@ -1076,7 +1078,7 @@ $(curmod_prefix)Undocumented.st3{T<:Integer, N} <: $(curmod_prefix)Undocumented.
10761078
@test docstrings_equal(@doc(Undocumented.st3), doc"$doc_str")
10771079

10781080
doc_str = Markdown.parse("""
1079-
No documentation found for private symbol.
1081+
No documentation found for private binding `$(curmod_prefix)Undocumented.st4`.
10801082
10811083
# Summary
10821084
@@ -1098,7 +1100,7 @@ $(curmod_prefix)Undocumented.st4{T, N} <: $(curmod_prefix)Undocumented.at0{T, N}
10981100
@test docstrings_equal(@doc(Undocumented.st4), doc"$doc_str")
10991101

11001102
doc_str = Markdown.parse("""
1101-
No documentation found for private symbol.
1103+
No documentation found for private binding `$(curmod_prefix)Undocumented.st5`.
11021104
11031105
# Summary
11041106
@@ -1119,7 +1121,7 @@ $(curmod_prefix)Undocumented.st5{T>:Int64, N} <: $(curmod_prefix)Undocumented.at
11191121
@test docstrings_equal(@doc(Undocumented.st5), doc"$doc_str")
11201122

11211123
doc_str = Markdown.parse("""
1122-
No documentation found for private symbol.
1124+
No documentation found for private binding `$(curmod_prefix)Undocumented.mt6`.
11231125
11241126
# Summary
11251127
@@ -1140,7 +1142,7 @@ $(curmod_prefix)Undocumented.mt6{T<:Integer, N} <: $(curmod_prefix)Undocumented.
11401142
@test docstrings_equal(@doc(Undocumented.mt6), doc"$doc_str")
11411143

11421144
doc_str = Markdown.parse("""
1143-
No documentation found for private symbol.
1145+
No documentation found for private binding `$(curmod_prefix)Undocumented.ut7`.
11441146
11451147
# Summary
11461148
@@ -1154,7 +1156,7 @@ No documentation found for private symbol.
11541156
@test docstrings_equal(@doc(Undocumented.ut7), doc"$doc_str")
11551157

11561158
doc_str = Markdown.parse("""
1157-
No documentation found for private symbol.
1159+
No documentation found for private binding `$(curmod_prefix)Undocumented.ut8`.
11581160
11591161
# Summary
11601162
@@ -1170,7 +1172,7 @@ No documentation found for private symbol.
11701172
@test docstrings_equal(@doc(Undocumented.ut8), doc"$doc_str")
11711173

11721174
doc_str = Markdown.parse("""
1173-
No documentation found for private symbol.
1175+
No documentation found for private binding `$(curmod_prefix)Undocumented.ut9`.
11741176
11751177
# Summary
11761178
@@ -1189,7 +1191,7 @@ let d = @doc(Undocumented.f)
11891191
io = IOBuffer()
11901192
show(io, MIME"text/markdown"(), d)
11911193
@test startswith(String(take!(io)),"""
1192-
No documentation found for private symbol.
1194+
No documentation found for private binding `$(curmod_prefix)Undocumented.f`.
11931195
11941196
`$(curmod_prefix)Undocumented.f` is a `Function`.
11951197
""")
@@ -1199,7 +1201,7 @@ let d = @doc(Undocumented.undocumented)
11991201
io = IOBuffer()
12001202
show(io, MIME"text/markdown"(), d)
12011203
@test startswith(String(take!(io)), """
1202-
No documentation found for private symbol.
1204+
No documentation found for private binding `$(curmod_prefix)Undocumented.undocumented`.
12031205
12041206
`$(curmod_prefix)Undocumented.undocumented` is a `Function`.
12051207
""")

0 commit comments

Comments
 (0)