I'm confused. In my startup.jl
I have @show isinteractive()
julia --banner=no
isinteractive() = false
julia> isinteractive()
true
julia>
and if I start a REPL in VS Code
isinteractive() = true
julia> isinteractive()
true
I thought I didn't need to use atreplinit
anymore, or something like that.
It must have something to do with how VS code starts the Julia process. It might even be considered a bug in the VS code plugin because as far as I know the startup.jl
is deliberately supposed to take place before the REPL initializes
If I had to take a guess I would say that they are starting a "bare" Julia process, initializing the REPL, and then handling some other initialization on their own after that
I mean the session is interactive in both cases
yeah, I expect the VS Code behavior honestly.
What is the right way to do what I intend?
My impression was that isinteractive()
was supposed to be interpreted as "is this a running REPL?" rather than being a property of the run-time itself, though the documentation would seem to support your perspective
isinteractive() -> Bool
Determine whether Julia is running an interactive session.
I still seem to be using atreplinit()
, my startup here
thanks @Expanding Man . I was under the misguided impression that atreplinit(f)
was "oldschool", but I think that was just because Revise
can now hook into it itself.
I do seem to recall someone saying that you shouldn't need atreplinit
anymore, but at the moment it's not clear to me why that would be the case
At least Revise claims not to need it however it does not rely on isinteractive()
in an obvious way, so it may be advice that can't be generalized to other startup stuff
@Sebastian Pfitzner do you believe the behavior with respect to isinteractive()
in startup.jl
should be consistent whether the REPL is run from my shell or from VS Code's terminal?
yes
I think the difference just comes down to VS Code invoking julia with the -i
flag
BTW I commenting on this related issue: https://github.com/JuliaLang/julia/issues/10779
FWIW, we can't start Julia without -i
because we also give a file to execute
Last updated: Dec 28 2024 at 04:38 UTC