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

REPLExt: check for compliant repl mode during repl init #4067

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions ext/REPLExt/REPLExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function create_mode(repl::REPL.AbstractREPL, main::LineEdit.Prompt)
return pkg_mode
end

function repl_init(repl::REPL.AbstractREPL)
function repl_init(repl::REPL.LineEditREPL)
main_mode = repl.interface.modes[1]
pkg_mode = create_mode(repl, main_mode)
push!(repl.interface.modes, pkg_mode)
Expand Down Expand Up @@ -311,7 +311,13 @@ end

function __init__()
if isdefined(Base, :active_repl)
repl_init(Base.active_repl)
if Base.active_repl isa REPL.LineEditREPL
repl_init(Base.active_repl)
else
# TODO: not sure what to do here..
# LineEditREPL Is the only type of REPL that has the `interface` field that
# init_repl accesses.
end
else
atreplinit() do repl
if isinteractive() && repl isa REPL.LineEditREPL
Expand Down
Loading