Skip to content

Commit 67e49a1

Browse files
sort method lists
1 parent 7abe5bc commit 67e49a1

File tree

1 file changed

+38
-6
lines changed

1 file changed

+38
-6
lines changed

src/PkgCacheInspector.jl

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,16 @@ function show_verbose_internal_methods(io::IO, info::PkgCacheInfo)
174174
end
175175
if !isempty(method_list)
176176
println(io, " ", name, " (", length(method_list), " methods)")
177+
# Capture method output in buffer and sort
178+
method_buffer = IOBuffer()
179+
method_io = IOContext(method_buffer, stdout)
177180
for method in method_list
178-
println(io, " ", method)
181+
println(method_io, " ", method)
182+
end
183+
method_lines = split(String(take!(method_buffer)), '\n', keepempty=false)
184+
sort!(method_lines)
185+
for line in method_lines
186+
println(io, line)
179187
end
180188
end
181189
elseif isa(obj, Type) && isa(obj, DataType)
@@ -188,8 +196,16 @@ function show_verbose_internal_methods(io::IO, info::PkgCacheInfo)
188196
end
189197
if !isempty(method_list)
190198
println(io, " ", name, " (", length(method_list), " constructors)")
199+
# Capture constructor output in buffer and sort
200+
constructor_buffer = IOBuffer()
201+
constructor_io = IOContext(constructor_buffer, stdout)
191202
for method in method_list
192-
println(io, " ", method)
203+
println(constructor_io, " ", method)
204+
end
205+
constructor_lines = split(String(take!(constructor_buffer)), '\n', keepempty=false)
206+
sort!(constructor_lines)
207+
for line in constructor_lines
208+
println(io, line)
193209
end
194210
end
195211
end
@@ -227,12 +243,20 @@ function show_verbose_external_methods(io::IO, info::PkgCacheInfo)
227243
# Show truly external methods
228244
if !isempty(truly_external_methods)
229245
println(io, " External methods (extending functions from other modules) (", length(truly_external_methods), " total):")
246+
# Capture external methods output in buffer and sort
247+
external_buffer = IOBuffer()
248+
external_io = IOContext(external_buffer, stdout)
230249
for (ci, method, mi) in truly_external_methods
231-
println(io, " ", method, " in ", method.module)
250+
println(external_io, " ", method, " in ", method.module)
232251
if !isempty(mi.specTypes.parameters)
233-
println(io, " specialized for: ", mi.specTypes)
252+
println(external_io, " specialized for: ", mi.specTypes)
234253
end
235254
end
255+
external_lines = split(String(take!(external_buffer)), '\n', keepempty=false)
256+
sort!(external_lines)
257+
for line in external_lines
258+
println(io, line)
259+
end
236260
end
237261

238262

@@ -261,8 +285,16 @@ function show_verbose_external_methods(io::IO, info::PkgCacheInfo)
261285
sorted_modules = sort(collect(module_specs); by=x->length(x[2]), rev=true)
262286
for (mod, specs) in sorted_modules
263287
println(io, " ", nameof(mod), " (", length(specs), " specializations):")
264-
for (method, spectype) in specs # Show all specializations
265-
println(io, " ", method.name, " specialized for ", spectype)
288+
# Capture specializations output in buffer and sort
289+
specs_buffer = IOBuffer()
290+
specs_io = IOContext(specs_buffer, stdout)
291+
for (method, spectype) in specs
292+
println(specs_io, " ", method.name, " specialized for ", spectype)
293+
end
294+
specs_lines = split(String(take!(specs_buffer)), '\n', keepempty=false)
295+
sort!(specs_lines)
296+
for line in specs_lines
297+
println(io, line)
266298
end
267299
end
268300
end

0 commit comments

Comments
 (0)