Interrupting while loops in VSCode

I’m confused by the behaviour of breaking while loops in VSCode when either using REPL only or running a script from a file.

Code:

while true
    println("foo")
    sleep(1)
end

If I type this into the VSCode REPL then I can easily interrupt the loop by pressing Ctrl+C.
(EDIT: I previously wrote that running and breaking the script from commandline would work. That’s not true, there I get EXCEPTION_ACCESS_VIOLATION)

In contrast, if I run the script in VSCode by pressing F5 and I try to interrupt the loop, I get back a working julia REPL prompt (“julia>”), but the periodic foo-printing continues (like from a background task).

This is maybe a minor thing, but quite annoying if you have to restart julia every time you want to adjust your loop-code slightly. (compilation time, etc.)

Is there any other way to interrupt code in VSCode?
Where is the difference actually coming from?

Windows 10, VSCode 1.41.1, julia plugin 0.13.1, Julia 1.3.0.

Could you open an issue on github for this? This is something we need to fix, just not sure yet how…

OK, done.
https://github.com/julia-vscode/julia-vscode/issues/969
Thanks

1 Like