AbbreviatedStackTraces.jl icon indicating copy to clipboard operation
AbbreviatedStackTraces.jl copied to clipboard

Support VSCode using startup.jl

Open jonniediegelman opened this issue 3 years ago • 8 comments

Currently AbbreviatedStackTraces doesn't work in VSCode if you have using AbbreviatedStackTraces in your startup.jl file. If you try to using again after startup, it still doesn't work. However it does work outside of VSCode using the startup.jl file and inside of VSCode not using the startup.jl file.

jonniediegelman avatar Jul 03 '22 19:07 jonniediegelman

Can you please clarify "doesn't work"?

BioTurboNick avatar Jul 03 '22 19:07 BioTurboNick

It just prints the normal stack trace as if you weren't using AbbreviatedStackTraces.

jonniediegelman avatar Jul 05 '22 16:07 jonniediegelman

Hmm, so the issue is that the VSCodeServer has its own custom REPL functions. Anything that loads before it does will get overwritten.

BioTurboNick avatar Jul 05 '22 16:07 BioTurboNick

One possible workaround is to set and read an environment variable. The problem is that you'd lose the ability to display full traces on demand, as it couldn't tell the difference between an original REPL error and a general show call.

BioTurboNick avatar Aug 28 '22 16:08 BioTurboNick

Another hotfix is delaying the laoding in startup.jl:

@async begin
    sleep(3)
    @eval using Suppressor
    @eval @suppress using AbbreviatedStackTraces
end

axsk avatar Aug 29 '22 08:08 axsk

Looks like you can also do this with atreplinit, which I guess is a bit less hacky as it hooks directly in to REPL initialisation and guarantees VSCode's REPL stuff has had time to do its thing

atreplinit() do _
    @eval using AbbreviatedStackTraces
end

ORBAT avatar Aug 02 '23 17:08 ORBAT

I wonder if, now that I have the requisite code in a package extension in the master branch, that AbbreviatedStackTraces in startup.jl works without extra tricks?

BioTurboNick avatar Sep 24 '24 02:09 BioTurboNick

Nope, doesn't. VSCodeServer isn't defined when the extension is loaded.

BioTurboNick avatar Sep 24 '24 17:09 BioTurboNick