KristofferC / OhMyREPL.jl

Syntax highlighting and other enhancements for the Julia REPL
https://kristofferc.github.io/OhMyREPL.jl/latest/
Other
770 stars 62 forks source link

Prompt pasting based on REPL mode #84

Open richardreeve opened 7 years ago

richardreeve commented 7 years ago

The prompt pasting support now in base is great, but it would be even better if it could recognise REPL modes. In particular where you have an example of language switching, such as after loading RCall:

julia> a = 2
2

julia> @rput a
2

R> a
[1] 2

R> b <- a + 1

julia> @rget b
3.0

julia> b
3.0

If I paste that into the REPL, I get:

julia> a = 2
2

julia> @rput a
2

julia> @rget b
ERROR: BoundsError
Stacktrace:
 [1] getindex at /Users/richardr/.julia/v0.6/RCall/src/methods.jl:461 [inlined]
 [2] getindex(::Ptr{RCall.EnvSxp}, ::Symbol) at /Users/richardr/.julia/v0.6/RCall/src/methods.jl:464
 [3] getindex(::RCall.RObject{RCall.EnvSxp}, ::Symbol) at /Users/richardr/.julia/v0.6/RCall/src/methods.jl:465

julia> b
ERROR: UndefVarError: b not defined

and it would be great if it respected the mode switches and so just worked as well...

pbouffard commented 1 year ago

Pasting based on mode was added to the base REPL in 1.7 (https://github.com/JuliaLang/julia/pull/40604), though it's currently undocumented (https://github.com/JuliaLang/julia/pull/49377), and works with OhMyREPL too (at least in 1.8 and 1.9 which is what I've tried -- and I had to update from 0.5.13 to 0.5.20 for it to work properly).

LilithHafner commented 7 months ago

Prompt pasting is broken in OhMyREPL v0.5.24 on Julia 1.11.0-alpha2 and Julia 1.9.4 on asahi linux in VSCode. It works without OhMyREPL.