-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf2006a
commit bc8774d
Showing
4 changed files
with
82 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
module AbbrvStackTracesVSCodeServerExt | ||
|
||
__precompile__(false) | ||
|
||
@eval Main begin | ||
import .VSCodeServer: | ||
crop_backtrace, | ||
EvalErrorStack, | ||
display_repl_error, | ||
replcontext, | ||
unwrap_loaderror | ||
|
||
import Base: | ||
showerror | ||
|
||
import Base.StackTraces: | ||
stacktrace | ||
|
||
function display_repl_error(io, err, bt) | ||
st = stacktrace(VSCodeServer.crop_backtrace(bt)) | ||
printstyled(io, "ERROR: "; bold=true, color=Base.error_color()) | ||
showerror(IOContext(io, :limit => true, :compacttrace => true), err, st) | ||
println(io) | ||
end | ||
function display_repl_error(io, stack::VSCodeServer.EvalErrorStack) | ||
printstyled(io, "ERROR: "; bold = true, color = Base.error_color()) | ||
for (i, (err, bt)) in enumerate(reverse(stack.stack)) | ||
i !== 1 && print(io, "\ncaused by: ") | ||
st = stacktrace(crop_backtrace(bt)) | ||
showerror(IOContext(io, :limit => true, :compacttrace => true), i == 1 ? unwrap_loaderror(err) : err, st) | ||
println(io) | ||
end | ||
end | ||
|
||
replcontext(io, limit_types_flag, hide_internal_frames_flag) = IOContext( | ||
io, | ||
:limit => true, | ||
:displaysize => get(stdout, :displaysize, (60, 120)), | ||
:stacktrace_types_limited => limit_types_flag, | ||
:compacttrace => hide_internal_frames_flag | ||
) | ||
|
||
function display_repl_error(io, err, bt; unwrap = false) | ||
limit_types_flag = Ref(false) | ||
hide_internal_frames_flag = Ref(true) | ||
|
||
st = stacktrace(crop_backtrace(bt)) | ||
printstyled(io, "ERROR: "; bold = true, color = Base.error_color()) | ||
showerror(replcontext(io, limit_types_flag, hide_internal_frames_flag), err, st) | ||
if limit_types_flag[] || hide_internal_frames_flag[] | ||
limit_types_flag[] && print(io, "Some type information was truncated. ") | ||
hide_internal_frames_flag[] && print(io, "Some frames were hidden. ") | ||
print(io, "Use `show(err)` to see complete trace.") | ||
println(io) | ||
end | ||
println(io) | ||
end | ||
|
||
function display_repl_error(io, stack::EvalErrorStack; unwrap = false) | ||
limit_types_flag = Ref(false) | ||
hide_internal_frames_flag = Ref(true) | ||
|
||
printstyled(io, "ERROR: "; bold = true, color = Base.error_color()) | ||
for (i, (err, bt)) in enumerate(reverse(stack.stack)) | ||
i !== 1 && print(io, "\ncaused by: ") | ||
st = stacktrace(crop_backtrace(bt)) | ||
showerror(replcontext(io, limit_types_flag, hide_internal_frames_flag), unwrap && i == 1 ? unwrap_loaderror(err) : err, st) | ||
println(io) | ||
end | ||
|
||
if limit_types_flag[] || hide_internal_frames_flag[] | ||
limit_types_flag[] && print(io, "Some type information was truncated. ") | ||
hide_internal_frames_flag[] && print(io, "Some frames were hidden. ") | ||
print(io, "Use `show(err)` to see complete trace.") | ||
println(io) | ||
end | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.