BioTurboNick / AbbreviatedStackTraces.jl

MIT License
142 stars 9 forks source link

1.10 broken? #63

Closed ParadaCarleton closed 1 year ago

ParadaCarleton commented 1 year ago

On the 1.10 beta, this seems to just not work; I'm getting the very long (unfolded) stacktraces again.

BioTurboNick commented 1 year ago

Could you please provide more detail? I'm not seeing a problem on 1.10.0-beta2

ParadaCarleton commented 1 year ago

It might only be on VSCode that it's a problem? When I use a terminal REPL it seems to work.

Example:

julia> using Folds, Transducers, Chain;  # semicolon makes it error, rather than prompt user to install packages
ERROR: ArgumentError: Package Chain not found in current path, maybe you meant `import/using .Chain`.
- Otherwise, run `import Pkg; Pkg.add("Chain")` to install the Chain package.
Stacktrace:
  [1] macro expansion
    @ Base ./loading.jl:1766 [inlined]
  [2] macro expansion
    @ Base ./lock.jl:267 [inlined]
  [3] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1747
  [4] #invoke_in_world#3
    @ Base ./essentials.jl:921 [inlined]
  [5] invoke_in_world
    @ Base ./essentials.jl:918 [inlined]
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1740
  [7] eval
    @ VSCodeServer ./boot.jl:383 [inlined]
  [8] eval
    @ VSCodeServer ./Base.jl:88 [inlined]
  [9] repleval(m::Module, code::Expr, ::String)
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.51.2/scripts/packages/VSCodeServer/src/repl.jl:229
 [10] (::VSCodeServer.var"#110#112"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.51.2/scripts/packages/VSCodeServer/src/repl.jl:192
 [11] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging ./logging.jl:515
 [12] with_logger
    @ VSCodeServer ./logging.jl:627 [inlined]
 [13] (::VSCodeServer.var"#109#111"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.51.2/scripts/packages/VSCodeServer/src/repl.jl:193
 [14] #invokelatest#2
    @ Base ./essentials.jl:887 [inlined]
 [15] invokelatest(::Any)
    @ Base ./essentials.jl:884
 [16] (::VSCodeServer.var"#62#63")()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.51.2/scripts/packages/VSCodeServer/src/eval.jl:34
BioTurboNick commented 1 year ago

This is what I see when I run Julia 1.10-beta2 inside VS Code and then use the "Connect external REPL" command:

julia> using AbbreviatedStackTraces
julia> using Folds;
ERROR: ArgumentError: Package Folds not found in current path.
- Run `import Pkg; Pkg.add("Folds")` to install the Folds package.       
Stacktrace:
   [1-5] ⋮ internal
       @ Base
     [6] require(into::Module, mod::Symbol)
       @ Base .\loading.jl:1740
     [7] eval
       @ VSCodeServer .\boot.jl:383 [inlined]
     [8] eval
       @ VSCodeServer .\Base.jl:88 [inlined]
     [9] repleval(m::Module, code::Expr, ::String)
       @ VSCodeServer c:\Users\nicho\.vscode\extensions\julialang.language-julia-1.51.2\scripts\packages\VSCodeServer\src\repl.jl:229
    [10] (::VSCodeServer.var"#110#112"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
       @ VSCodeServer c:\Users\nicho\.vscode\extensions\julialang.language-julia-1.51.2\scripts\packages\VSCodeServer\src\repl.jl:192
    [11] with_logstate(f::Function, logstate::Any)
       @ Base.CoreLogging .\logging.jl:515
    [12] with_logger
       @ VSCodeServer .\logging.jl:627 [inlined]
    [13] (::VSCodeServer.var"#109#111"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
       @ VSCodeServer c:\Users\nicho\.vscode\extensions\julialang.language-julia-1.51.2\scripts\packages\VSCodeServer\src\repl.jl:193
    [14] ⋮ internal
       @ Base
    [15] invokelatest(::Any)
       @ Base .\essentials.jl:884
    [16] (::VSCodeServer.var"#62#63")()
       @ VSCodeServer c:\Users\nicho\.vscode\extensions\julialang.language-julia-1.51.2\scripts\packages\VSCodeServer\src\eval.jl:34
Use `err` to retrieve the full stack trace.

What you posted shows nothing missing however, whereas mine does exclude some frames, though not enough. What's happening here is that it thinks VSCodeServer is user code; the method for detecting these frames wasn't in the right module.

Does defining this fix the issue for you?

AbbreviatedStackTraces.is_ide_support(path) = contains(path, r"[/\\].vscode[/\\]")

If this does not, it's something else.

ParadaCarleton commented 1 year ago

Unfortunately not.

[ Info: Precompiling AbbreviatedStackTraces [ac637c84-cc71-43bf-9c33-c1b4316be3d4]
[ Info: Skipping precompilation since __precompile__(false). Importing AbbreviatedStackTraces [ac637c84-cc71-43bf-9c33-c1b4316be3d4].
julia> AbbreviatedStackTraces.is_ide_support(path) = contains(path, r"[/\\].vscode[/\\]")

julia> using Turing;
ERROR: ArgumentError: Package Turing not found in current path.
- Run `import Pkg; Pkg.add("Turing")` to install the Turing package.
Stacktrace:
  [1] macro expansion
    @ Base ./loading.jl:1766 [inlined]
  [2] macro expansion
    @ Base ./lock.jl:267 [inlined]
  [3] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1747
  [4] #invoke_in_world#3
    @ Base ./essentials.jl:921 [inlined]
  [5] invoke_in_world
    @ Base ./essentials.jl:918 [inlined]
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1740
  [7] eval
    @ VSCodeServer ./boot.jl:383 [inlined]
  [8] eval
    @ VSCodeServer ./Base.jl:88 [inlined]
  [9] repleval(m::Module, code::Expr, ::String)
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.51.2/scripts/packages/VSCodeServer/src/repl.jl:229
 [10] (::VSCodeServer.var"#110#112"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.51.2/scripts/packages/VSCodeServer/src/repl.jl:192
 [11] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging ./logging.jl:515
 [12] with_logger
    @ VSCodeServer ./logging.jl:627 [inlined]
 [13] (::VSCodeServer.var"#109#111"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.51.2/scripts/packages/VSCodeServer/src/repl.jl:193
 [14] #invokelatest#2
    @ Base ./essentials.jl:887 [inlined]
 [15] invokelatest(::Any)
    @ Base ./essentials.jl:884
 [16] (::VSCodeServer.var"#62#63")()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.51.2/scripts/packages/VSCodeServer/src/eval.jl:34
BioTurboNick commented 1 year ago

Any chance you're trying to use it from startup.jl? https://github.com/BioTurboNick/AbbreviatedStackTraces.jl/issues/38

ParadaCarleton commented 1 year ago

Yes! Thank you.