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

World error when pasting code into REPL (prompt pasting) that loads Pkg and also switches to Pkg mode #52120

Closed
KristofferC opened this issue Nov 10, 2023 · 5 comments · Fixed by #53696
Labels
bug Indicates an unexpected problem or unintended behavior REPL Julia's REPL (Read Eval Print Loop)
Milestone

Comments

@KristofferC
Copy link
Member

KristofferC commented Nov 10, 2023

Paste this into the REPL without loading Pkg first:

julia> 1+1
2

pkg> st

julia> 1+1
2
julia> 1+1
2


(@v1.12) pkg> st
┌ Error: Error in the keymap
│   exception =
│    MethodError: no method matching (::REPLExt.var"#31#34"{REPL.LineEditREPL, REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::IOBuffer, ::Bool)
│    The applicable method may be too new: running in world age 26348, while current world is 26369.
│    
│    Closest candidates are:
│      (::REPLExt.var"#31#34")(::Any, ::Any, ::Any) (method too new to be called from this world context.)
│       @ REPLExt ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/Pkg/ext/REPLExt/REPLExt.jl:118
│    
│    Stacktrace:
│     [1] (::REPL.var"#113#125"{Regex, Regex, Int64, Int64, REPL.LineEdit.Prompt, REPL.LineEdit.Prompt, REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Any, ::Vararg{Any})
│       @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/REPL.jl:1342
│     [2] #invokelatest#2
│       @ ./essentials.jl:1030 [inlined]
│     [3] invokelatest
│       @ ./essentials.jl:1027 [inlined]
│     [4] (::REPL.LineEdit.var"#27#28"{REPL.var"#113#125"{Regex, Regex, Int64, Int64, REPL.LineEdit.Prompt, REPL.LineEdit.Prompt, REPL.LineEdit.Prompt}, String})(s::Any, p::Any)
│       @ REPL.LineEdit ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:1700
│     [5] prompt!(term::REPL.Terminals.TextTerminal, prompt::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
│       @ REPL.LineEdit ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2837
│     [6] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
│       @ REPL.LineEdit ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2739
│     [7] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
│       @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/REPL.jl:1406
│     [8] (::REPL.var"#75#81"{REPL.LineEditREPL, REPL.REPLBackendRef})()
│       @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/REPL.jl:456
└ @ REPL.LineEdit ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2839

guess this needs an @invokelatest.

@KristofferC KristofferC added bug Indicates an unexpected problem or unintended behavior REPL Julia's REPL (Read Eval Print Loop) labels Nov 10, 2023
@vtjnash vtjnash closed this as completed Feb 27, 2024
@vtjnash
Copy link
Member

vtjnash commented Feb 27, 2024

I think we did this, since I can switch to Pkg mode in v1.10

@KristofferC
Copy link
Member Author

Pkg is in the sysimage in 1.10 though?

@KristofferC
Copy link
Member Author

Updated the OP to show that this is still an issue.

@KristofferC KristofferC reopened this Feb 28, 2024
@KristofferC
Copy link
Member Author

This call is actually already using an invokelatest so it is a bit strange to me why this happens.

@KristofferC KristofferC added this to the 1.11 milestone Feb 28, 2024
@JeffBezanson
Copy link
Member

I think

LineEdit.mode(s).on_done(s, LineEdit.buffer(s), true)
needs an invokelatest as well. We run the paste key handler with invokelatest, but then execution of the line loads Pkg and the world changes again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants