Skip to content

Commit

Permalink
REPLExt: check for compliant repl mode during repl init (#4067)
Browse files Browse the repository at this point in the history
* check for compliant repl mode during repl init

* Update ext/REPLExt/REPLExt.jl
  • Loading branch information
IanButterworth authored Nov 4, 2024
1 parent 9f8e11a commit e10883c
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
# 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

0 comments on commit e10883c

Please sign in to comment.