Skip to content

Commit

Permalink
check for compliant repl mode during repl init
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Oct 30, 2024
1 parent 9f8e11a commit bc963be
Showing 1 changed file with 8 additions and 2 deletions.
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
# 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

0 comments on commit bc963be

Please sign in to comment.