Skip to content

Commit

Permalink
Load Pkg if not already to reinstate missing package add prompt (#52125)
Browse files Browse the repository at this point in the history
(cherry picked from commit 0d029ea)
  • Loading branch information
IanButterworth authored and KristofferC committed Mar 15, 2024
1 parent e6e8a1d commit fcadc06
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions stdlib/REPL/src/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ function eval_user_input(@nospecialize(ast), backend::REPLBackend, mod::Module)
put!(backend.response_channel, Pair{Any, Bool}(lasterr, true))
else
backend.in_eval = true
if !isempty(install_packages_hooks)
check_for_missing_packages_and_run_hooks(ast)
end
check_for_missing_packages_and_run_hooks(ast)
for xf in backend.ast_transforms
ast = Base.invokelatest(xf, ast)
end
Expand All @@ -244,6 +242,7 @@ function check_for_missing_packages_and_run_hooks(ast)
mods = modules_to_be_loaded(ast)
filter!(mod -> isnothing(Base.identify_package(String(mod))), mods) # keep missing modules
if !isempty(mods)
isempty(install_packages_hooks) && Base.require_stdlib(Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg"))
for f in install_packages_hooks
Base.invokelatest(f, mods) && return
end
Expand Down Expand Up @@ -1651,7 +1650,6 @@ function __current_ast_transforms(backend)
end
end


function numbered_prompt!(repl::LineEditREPL=Base.active_repl, backend=nothing)
n = Ref{Int}(0)
set_prompt(repl, n)
Expand Down

0 comments on commit fcadc06

Please sign in to comment.