Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abbreviated stack traces #3006

Closed
cstjean opened this issue Aug 20, 2024 · 5 comments · Fixed by #3045
Closed

Abbreviated stack traces #3006

cstjean opened this issue Aug 20, 2024 · 5 comments · Fixed by #3045
Labels
backend Concerning the julia server and runtime display & PlutoRunner & AbstractPlutoDingetjes.jl error display How errors and stack traces are presented good first issue Good for newcomers

Comments

@cstjean
Copy link

cstjean commented Aug 20, 2024

Julia 1.10 introduced abbreviated stack traces at the REPL, where some of type information is omitted (printed as ...), eg.

image

This is critical for working with parametric-type-enthusiastic packages, like ModelingToolkit.jl. I frequently get stack traces which are over a hundred pages long in Pluto, whereas at the REPL it is a few pages at most. The above renders as

image

(though this is not a great example of the problem, sorry).

Is there a way to get REPL-like abbreviated stack traces in Pluto?

Note: I'm on Pluto 1.19.42, apologies if this has been fixed since.

@fonsp fonsp added good first issue Good for newcomers backend Concerning the julia server and runtime display & PlutoRunner & AbstractPlutoDingetjes.jl labels Aug 24, 2024
@fonsp
Copy link
Owner

fonsp commented Aug 24, 2024

Thanks @cstjean! Let's implement it in Pluto!

The first step here is to figure out how this is done in the REPL. Maybe you can find it by searching the Julia source code for the · (middle dot) character, or you could find the Pull Request in julialang/julia that added this feature. Comment on this issue to report your findings.

The second step is to add it to Pluto! We need to modify the function pretty_stackcall in this file: https://github.com/fonsp/Pluto.jl/blob/main/src/runner/PlutoRunner/src/display/Exception.jl

Check out https://github.com/fonsp/Pluto.jl/tree/main/src/runner/PlutoRunner#development-tip when working on this issue!

@cstjean
Copy link
Author

cstjean commented Aug 27, 2024

I'm 99% sure the PR and relevant function is in https://github.com/JuliaLang/julia/pull/49795/files#diff-c616894fef3ba781d1e1cf77a08e69f366ffd9e5b1cfe1220e7bdae85377e0b2R2537. Given that it merely parses the stacktrace's String and returns a String, it should be straight-forward. The main issue might be Some type information was truncated. Use show(err) to see complete types. This works fine at the REPL, but it's not very Pluto-esque. Ideally, it'd be nice to be able to click on an stacktrace line to see the full parametric type (as in the tree-viewer), but that's maybe a lot of work.

I unfortunately cannot contribute to open-source given my present employment, but it may change in the future...

@fonsp
Copy link
Owner

fonsp commented Aug 27, 2024

Clicking to see more is definitely possible! Not too hard to implement.

We can start by showing just the truncated stack frame.

Later, we can implement clicking-to-see-more by adding both versions (:call and :call_full) to this dictionary. In the frontend, it's a simple mechanism to handle the click.

@fonsp
Copy link
Owner

fonsp commented Aug 27, 2024

@cstjean Could you also post a snippet of code that generates a very long stack trace?

EDIT this one is used by the Julia tests, check the difference between Pluto and REPL:

# ╔═╡ 6ed41642-644b-11ef-1190-8ddd8aa72d7c
begin
	
	struct F49231{a,b,c,d,e,f,g} end
	(::F49231)(a,b,c) = error("oops")
end

# ╔═╡ ffe76e2f-60b1-4da9-a165-a40d14364db2
F49231{Vector,Val{'}'},Vector{Vector{Vector{Vector}}},Tuple{Int,Int,Int,Int,Int,Int,Int},Int,Int,Int}()(1,2,3)

@fonsp fonsp added the error display How errors and stack traces are presented label Oct 3, 2024
@fonsp fonsp linked a pull request Oct 4, 2024 that will close this issue
@fonsp
Copy link
Owner

fonsp commented Oct 4, 2024

@cstjean If you have more ideas please let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Concerning the julia server and runtime display & PlutoRunner & AbstractPlutoDingetjes.jl error display How errors and stack traces are presented good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants