A recent discussion about making Julia more accessible inspired me to work on the Stack trace display in Pluto, and it has gotten a bunch of upgrades!
I was inspired by the recent improvements to stack traces in the REPL in Julia 1.10. (Those are also available in Pluto now!) Since Pluto is not a terminal application, we can use interactivity and colorful design! Here are some of the new features
Code previews
The most relevant frames are (often) those from your own code. In this PR, you get a small preview of the code from your notebook that made the call. You can click to jump to the line.
We also show the lines around the call for context. We show 4 extra lines for code from another cell, 2 for the current cell. I also cropped the frame a bit to make it look more like “preview window”.
Truncated stack trace
We search for the first frame that comes from this notebook, and all frames that came before it are hidden behind a "More..."
button. This makes the stack trace less intimidating, and it is hopefully a good heuristic for “which frames are more useful?”.
URLs
You can click on locations from the notebook (like “Other cell: line 3”), and you will scroll to and highlight the code line.
You can now also click on file locations from Julia Base, and it will send you to the source code on github Adding this functionality for stdlibs and remote packages is WIP.
Hide “top-level-scope”
We don’t show the text “top-level scope”, just the location file:line
, because it’s too computer-sciency.
New design
New design makes the stack trace look more inviting! It also adds more visual variety. Locations are colored based on their type. There is also a title and some text to explain what the stack trace is.
Hide “UndefVarError” in some cases
If you get an UndefVarError, but you have another cell that could have defined that variable, then we replace the error and stack trace with a reference to the variable.
In this case, the cell on the bottom would show “UndefVarError”. Instead, it shows a clickable reference to a
.
The UndefVarError mechanic was contributed by @Hirumal_Priyashan
Try it!
The new stack traces are available in the newest Pluto version, 0.19.39
. Update Pluto to try it out!
Suggestions?
Do you have any ideas for improving the display of stack traces? Let us know!