Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

softscope #351

Merged
merged 5 commits into from Sep 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/eval.jl
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/repl.jl
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/utils.jl
Expand Up @@ -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