So with the new Debugger integration into Juno there’s a lot more incentive to have Revise loaded within a Juno session, but I ran into some issues where loading Revise in my startup.jl
was problematic because Atom wasn’t loaded yet, so Revise didn’t know to hook into its eval loop, so evaluating things in Atom didn’t trigger Revise-magic.
I think I have a pretty good setup, so I figured I’d share - it might be useful to some folks and others may have improvements.
Here’s the contents of my startup.jl
. It does a few things:
- activate the project in the current directory if there’s a
Project.toml
- load Revise.jl
- load OhMyREPL
ENV["JULIA_PKG_DEVDIR"] = "$(ENV["HOME"])/Dropbox/juliadev"
using Pkg
if isfile("Project.toml")
# auto-activate project in current directory
@info "Activating project in $(pwd())"
Pkg.activate(".")
end
@info "Importing Revise"
try
using Revise
# configure Revise to run revise() before every REPL eval
Revise.async_steal_repl_backend()
catch ex
@warn "Could not load Revise: $ex"
end
@info "Importing OhMyREPL"
try
using OhMyREPL
colorscheme!("Monokai24bit")
catch ex
@warn "Could not load OhMyREPL: $ex"
end
Now typically when launching Julia in Juno this would get run before the REPL starts up and before Juno loads all its Atom/Juno goodies. So all I did was add the --startup-file=no
option in the julia-client
settings:
and then created the following ~/.julia/config/juno_startup.jl
ENV["AWESOME_ATOM"] = true
include("startup.jl")
This does two things:
- now
startup.jl
gets run AFTER Juno has a chance to set itself up - from within my
startup.jl
I can checkif "AWESOME_ATOM" in keys(ENV)"
if I want to add any Atom-specific code to my startup.jl.