Skip to content

Commit

Permalink
Add helper
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Apr 19, 2024
1 parent 9025bc2 commit fccf284
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Cthulhu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ include("reflection.jl")
include("ui.jl")
include("codeview.jl")
include("backedges.jl")
include("print.jl")

export descend, @descend, descend_code_typed, descend_code_warntype, @descend_code_typed, @descend_code_warntype
export ascend
Expand Down
10 changes: 10 additions & 0 deletions src/print.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function type_depth_limit(data; maxtypedepth::Union{Nothing,Int}=2)
buf = IOBuffer()
type_depth_limit(buf, string(data); maxtypedepth)
return String(take!(buf))
end

function type_depth_limit(io::IO, s::String; maxtypedepth::Union{Nothing,Int}=2)
sz = get(io, :displaysize, displaysize(io))::Tuple{Int, Int}
return Base.type_depth_limit(s, max(sz[2], 120); maxdepth=maxtypedepth)
end

0 comments on commit fccf284

Please sign in to comment.