Skip to content

Commit

Permalink
special show for AbstractVector{Method} for ::MIMEtext/plain (#22068)
Browse files Browse the repository at this point in the history
which is currently done for text/html
this enables the jump-to-method thingy from #22007 to be used with methodswith(Foo) also
This also prevents large spacing in the printing, since the general vector output prints with equal spacing for all elements, and some methods have very long signatures
  • Loading branch information
fredrikekre authored and KristofferC committed Jun 4, 2017
1 parent 39777e7 commit 2c6273b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion base/methodshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,16 @@ end

show(io::IO, mime::MIME"text/html", mt::MethodTable) = show(io, mime, MethodList(mt))

# pretty-printing of Vector{Method} for output of methodswith:
# pretty-printing of AbstractVector{Method} for output of methodswith:
function show(io::IO, mime::MIME"text/plain", mt::AbstractVector{Method})
resize!(LAST_SHOWN_LINE_INFOS, 0)
for (i, m) in enumerate(mt)
print(io, "[$(i)] ")
show(io, m)
println(io)
push!(LAST_SHOWN_LINE_INFOS, (string(m.file), m.line))
end
end

function show(io::IO, mime::MIME"text/html", mt::AbstractVector{Method})
print(io, summary(mt))
Expand Down

0 comments on commit 2c6273b

Please sign in to comment.