How to debug a script in existing REPL using VSCode

Hello all,

I often use VSCode when I want to debug code and I conversely put breakpoints into functions and call the functions in my Julia session (in the REPL) using the macro @run myFunc(x) (or even @enter). This works perfectly well by the way.

But this approach does not work if I put breakpoints in a script (for instance in a for loop) and not in a function. I tried @run include("myScript.jl") without success.
It does however works if I use the command Julia: Debug file in a new process [but the issue here is that it launches a fresh Julia session which takes way more time than reusing the REPL.]

So what is the magic command to have script and debugger with REPL ?

Thanks in advance :slight_smile:

There is none, currently. It’s possible to implement @run for top-level blocks instead of only for function calls though.

Ok many thanks for the quick reply and the opened issue on VSCode side (https://github.com/julia-vscode/julia-vscode/issues/2146) !

1 Like

currently. It’s possible to implement @run for top-level blocks

how is this implemented ? are the top-level blocks just wrapped into a function ?

I am asking because I would like be able to debug files directly from the REPL.
The use case is for the ./test/* files.