diff --git a/src/eval.jl b/src/eval.jl index 9f8f9c25..a0a7c181 100644 --- a/src/eval.jl +++ b/src/eval.jl @@ -72,7 +72,8 @@ function evalshow(text, line, path, mod) result = hideprompt() do with_logger(JunoProgressLogger()) do withpath(path) do - res = @errs include_string(mod, text, path, line) + args = @static VERSION ≥ v"1.5" ? (REPL.softscope, mod, text, path, line) : (mod, text, path, line) + res = @errs include_string(args...) Base.invokelatest() do if res isa EvalError @@ -116,7 +117,8 @@ function eval(text, line, path, mod, errorinrepl = false) result = hideprompt() do with_logger(JunoProgressLogger()) do withpath(path) do - res = @errs include_string(mod, text, path, line) + args = @static VERSION ≥ v"1.5" ? (REPL.softscope, mod, text, path, line) : (mod, text, path, line) + res = @errs include_string(args...) if errorinrepl && res isa EvalError Base.invokelatest() do try diff --git a/src/repl.jl b/src/repl.jl index 8c2ed548..040fe2b1 100644 --- a/src/repl.jl +++ b/src/repl.jl @@ -220,6 +220,9 @@ function evalrepl(mod, line) end errored && return nothing try + @static if VERSION ≥ v"1.5" + line = REPL.softscope(line) + end ans = repleval(mod, line) catch err # #FIXME: This is a bit weird (there shouldn't be any printing done here), but diff --git a/src/utils.jl b/src/utils.jl index e88614da..518daaa2 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -274,3 +274,8 @@ uriopen(file, line = 0) = "atom://julia-client/?open=true&file=$(file)&line=$(li uridocs(mod, word) = "atom://julia-client/?docs=true&mod=$(mod)&word=$(word)" urigoto(mod, word) = "atom://julia-client/?goto=true&mod=$(mod)&word=$(word)" urimoduleinfo(mod) = "atom://julia-client/?moduleinfo=true&mod=$(mod)" + + +function Base.include_string(f, mod, s::AbstractString, fname::AbstractString, line::Integer) + include_string(f, mod, "\n"^(line-1)*s, fname) +end