[ANN] VS Code extension v0.15 released - with debugger

Congrats on the addition of this ! VSCode is so smooth to use :).

I face the following error when I try to launch a specific debug command. A MWE

# File test.jl
function test(a);
 b = 2a + 1;
 return b;

and I set a breakpoint on l2 (b = 2a+1).
Then, in the Julia VS terminal I type

@enter test(12)

I get the following error

ERROR: IOError: connect: name too long (ENAMETOOLONG)
[1] wait_connected(::Base.PipeEndpoint) at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Sockets/src/Sockets.jl:520
[2] connect at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Sockets/src/Sockets.jl:555 [inlined]
[3] connect at /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Sockets/src/PipeServer.jl:97 [inlined]
[4] startdebug(::String) at /Users/gerzaguet/.vscode/extensions/julialang.language-julia-insider-0.15.17/scripts/debugger/debugger.jl:44
[5] (::Main._vscodeserver.var"#10#14"{Array{UInt8,1}})() at /Users/gerzaguet/.vscode/extensions/julialang.language-julia-insider-0.15.17/scripts/terminalserver/terminalserver.jl:177
[6] hideprompt(::Main._vscodeserver.var"#10#14"{Array{UInt8,1}}) at /Users/gerzaguet/.vscode/extensions/julialang.language-julia-insider-0.15.17/scripts/terminalserver/repl.jl:28
[7] macro expansion at /Users/gerzaguet/.vscode/extensions/julialang.language-julia-insider-0.15.17/scripts/terminalserver/terminalserver.jl:174 [inlined]
[8] (::Main._vscodeserver.var"#7#11")() at ./task.jl:333

Additionnal useful remarks

  • Same happens if I run @run test(12)
  • If I add test(12) in the file (after function definition) and then execute active file, no error occurs
  • I currently debug in a package environment, on macOS, with Julia 1.3

julia> versioninfo()
Julia Version 1.3.0
Commit 46ce4d7933 (2019-11-26 06:09 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin19.0.0)
CPU: Intel® Core™ i7-7567U CPU @ 3.50GHz
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
JULIA_EDITOR = “/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code”

So can we use a @enter or a @run in an existing Julia session ? If so, any idea on what is wrong ?

Very cool to see. I’m assuming this is based on the debug adapter protocol? Where does the code for this live? I’d love to poke through it.

Very nice! Looking forward to using this extensively.

I have one potentially stupid question: how can I run julia scripts from a julia file in REPL “the old way”, such that I can interactively work in the REPL when the script has finished?
For me (VSCode 1.43.1, Windows 10, Julia 1.4, Julia plugin 0.15.6), both, using “Start Debugging (F5)” and “Run Without Debugging (Ctrl+F5)” run the script in a “julia debugger”, none in a currently active “julia” REPL window.

Hence, every excecution now ends with output
Julia debuggee finished. Press ENTER to close this terminal.

The GUI is very convenient. You can create a launch.json file and configure how to start the program. The following is one of my launch.json file in /.vscode/. Every time you just press “F5” to start debugging on Windows system. The speed is improved a lot compared with the very earlier pre-release version. I using it for may daily work now.

    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
            "type": "julia",
            "request": "launch",
            "name": "Run active Julia file",
            "program": "${workspaceFolder}/test/small_network.jl",   # the enter of the program
            "stopOnEntry": false,
            "cwd": "${workspaceFolder}",
            "juliaEnv": "${command:activeJuliaEnvironment}"    
1 Like

https://github.com/julia-vscode/julia-vscode/pull/1003, no timeline.

Ah, thanks for the report, I think I know how to fix this. I’ll try to push a new build soon.

Right now we are using this hook, so not a direct implementation of the DAP. And then the VS Code extension communicates with the Julia process via a custom protocol over named pipes. That was the easiest way to implement it initially, but I plan to eventually replace the custom protocol with DAP itself. The debugging code in the extension is here, the Julia side of things is mostly here.

Ah, I should have mention that: this is the one breaking change with this update, F5 now starts the debugger and no longer runs the currently active file in the REPL. We didn’t configure a new keyboard shortcut for “Run File in REPL”, but the command still exists (language-julia.executeJuliaFileInREPL) and you should be able to configure your own keyboard shortcut for it. Tracking this here.

That is a really good point: there is a wealth of config options there! I think one can even configure it to start multiple things at the same time? I never tried it, but I think that actually works.

1 Like

I just pushed a new version v0.15.18 that should fix this!


Thank you. You are the best :+1:

Thank you very much @davidanthoff, It now perfetly works. :slight_smile:

1 Like

Dumb of me but I can’t find where to open a julia REPL from which I can run the debugger using the @run macro. I can only see the Terminal -> New terminal but that opens a power shell. But I don’t want power shells for nothing.

How can I access to the VS julia REPL?

Use the Julia: Start REPL command.

1 Like

OK, thanks. But

ERROR: could not open file c:\Users\joaqu\.vscode\extensions\julialang.language-julia-0.15.16\scripts\terminalserver\terminalserver.jl
 [1] include(::Module, ::String) at .\Base.jl:377     
 [2] exec_options(::Base.JLOptions) at .\client.jl:288
 [3] _start() at .\client.jl:484

Trying to install 0.15.18 but it fails and tells me to download it manually, which I do but it’s still downloading 0.15.16

Hm, that is weird, that very much looks like something went wrong with the install of the extension… I don’t really understand how you can get an error message that involves 0.15.16 while it is still downloading that version? Maybe just uninstall all versions, restart VS Code and then install again from the marketplace?

No, I had installed 0.15.16 before (same story, failed automatic install, dwl manually and installed). Now I was trying to update to 0.15.18

Closed, VS, reopened, the julia extension had gone, reinstalled. Now 0.15.18 and the error above desapear. Seems all good.

1 Like

I can’t figure out how to see what call is next like in the old REPL debugger. Also, there doesn’t seem to be the “next call” (nc) command…

is it possible to go back to the REPL debugger when I type @enter?

We are constrained in terms of UI to what VS Code offers, so we don’t have those features.

Presumably Debugger.@enter etc. would work.

1 Like

amazing - trying it out now!

Should note somewhere that it needs to have the latest vscode 1.43+, i had 1.40 before and the latest version didn’t show up/refused to install when i downloaded it manually.

Just signed up to leave a THANK YOU!
This is much needed! I have so much trouble establishing a good debugging routine with julia.
So glad I found this, will try it out immediately! :smiley:


I’m trying to use this with macOS, but the debugger isn’t stopping at breakpoints. Has anyone else experienced this?

How are you running your code? You need to either use the @run macro or e.g. use the Debug Julia File command.