Problem with @enter when using Debugger.jl in VS Code console

Hi, everyone,

I am using Debugger.jl in VS Code REPL. It seems that there is a problem of the @enter macro, as following code shows:


julia> using Debugger

julia> foo(x) = x^2
foo (generic function with 1 method)

julia> @enter foo(2)
ERROR: UndefVarError: @enter not defined
Stacktrace:
 [1] top-level scope
 [2] include_string(::Function, ::Module, ::String, ::String) 
at .\loading.jl:1088

julia> 

I am using Julia 1.5.1 and Debugger version 0.6.6

How could I avoid this error message and use Debugger in VS Code REPL?

1 Like

Just omit the using Debugger and you’ll use VSCode’s visual debugger.

If you prefer the text-based debugger then do:

import Debugger
Debugger.@enter foo(2)

This avoids the collision with VSCodeServer.@enter (which is exported too).

6 Likes

Thank you Tim, perfect explanation! Help me a lot since I’ve struggled with Debugger for long time.

Is it possible to use Debugger.@enter so that I can navigate with the gui of vs code and the variable explorer? My use case is that I would like to evaluate a several lines of code in a script with Julia: Execute Code Block (Alt+Enter) and then just would like to debug a specific function, which arguments depend on the code evaluated ahead.

No, but you can just use the exported @enter available in the integrated REPL instead.

1 Like

For me @enter isn´t defined, but maybe I use the wrong REPL. However, VSCodeServer.@enter works for me.

That’s probably because you said using Debugger and the conflict between the two definitions of @enter meant that neither was available. Just don’t say using Debugger.

1 Like

Sorry, I forgot to answer. You´re right. I used using Debugger inside the startup.jl-file