Skip to content

Commit

Permalink
Use StyledStrings Faces for stacktrace printing
Browse files Browse the repository at this point in the history
This allows for the faces used (e.g. the file path) to be
user-customised, which provides an escape from themes that make bright
black invisible.
  • Loading branch information
tecosaur committed Mar 4, 2024
1 parent 4b2f6c1 commit 478144e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions base/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ function showerror(io::IO, ex, bt; backtrace=true)
end
end

function stacktrace_path(file::Union{Nothing, String}, line::Union{Nothing, Int64})
function stacktrace_path(file::Union{Nothing, String}, line::Union{Nothing, Int})
realfile = if !isnothing(file) && file != "" && !startswith(String(file), "REPL")
fixup_stdlib_path(String(file))
String(file) |> fixup_stdlib_path |> find_source_file
end
pathstr = file
if !isnothing(pathstr)
Expand Down Expand Up @@ -802,7 +802,8 @@ function print_stackframe(io, i, frame::StackFrame, n::Int, ndigits_max, modulec
print(io, if inlined AnnotatedString("[inlined]", [(1:9, :face => :julia_stacktrace_inlined)]) else "" end)
end

function print_module_path_file(io, modul, file, line; modulecolor = :bright_black, digit_align_width = 0)
function print_module_path_file(io::IO, modul::Module, file::Union{Nothing, String}, line::Union{Nothing, Int};
modulecolor = :bright_black, digit_align_width = 0)
print(io, ' ' ^ digit_align_width, AnnotatedString("@", [(1:1, :face => :julia_stacktrace_location)]))
if modul !== nothing && modulecolor !== nothing
mstr = string(modul)
Expand Down

0 comments on commit 478144e

Please sign in to comment.