Browse Source

[julia] Improve automatic loading of Debugger.

master
Fredrik Ekre 3 years ago
parent
commit
88114871da
  1. 6
      .julia/config/startup.jl

6
.julia/config/startup.jl

@ -11,8 +11,10 @@ if Base.isinteractive() && @@ -11,8 +11,10 @@ if Base.isinteractive() &&
# Automatically load Debugger.jl when encountering @enter
pushfirst!(REPL.repl_ast_transforms, function(ast::Union{Expr,Nothing})
if Meta.isexpr(ast, :toplevel, 2) && Meta.isexpr(ast.args[2], :macrocall) &&
ast.args[2].args[1] === Symbol("@enter") && !isdefined(Main, Symbol("@enter"))
contains_enter(x) = false
contains_enter(x::Expr) = (Meta.isexpr(x, :macrocall) && x.args[1] === Symbol("@enter")) ||
any(contains_enter, x.args)
if Meta.isexpr(ast, :toplevel, 2) && contains_enter(ast) && !isdefined(Main, Symbol("@enter"))
@info "Loading Debugger..."
Core.eval(Main, :(using Debugger))
end

Loading…
Cancel
Save