KristofferC / OhMyREPL.jl

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

"UndefRefError: access to undefined reference" in 1.11 beta #345

Open numbermaniac opened 2 months ago

numbermaniac commented 2 months ago

Following the installation guide, I have this in my startup.jl file:

atreplinit() do repl
    try
        @eval using OhMyREPL
    catch e
        @warn "error while importing OhMyREPL" e
    end
end

In Julia 1.11 beta 1, I see the following message when starting a repl now:

┌ Warning: error while importing OhMyREPL
│   e =
│    InitError: UndefRefError: access to undefined reference
│    during initialization of module REPLExt
└ @ Main ~/.julia/config/startup.jl:5

I didn't see this message in 1.10, so I'm guessing it's something to do with 1.11 specifically. The error message means that none of the syntax highlighting works.

Interestingly if I do using OhMyREPL after the repl has started up, then there are no import errors and all syntax highlighting works. So it seems like something is broken here.

osimonn commented 1 month ago

I tried slimming down my startup.jl file to just using OhMyREPL but I get the following error when entering Pkg mode and try to add a package:

(@v1.11) pkg> add ┌ Error: Error in the keymap
│   exception =
│    IOError: stat("DriverState\\\\"): permission denied (EACCES)
│    Stacktrace:
│      [1] uv_error
│        @ .\libuv.jl:106 [inlined]
│      [2] stat(path::String)
│        @ Base.Filesystem .\stat.jl:176
│      [3] isdir
│        @ .\stat.jl:494 [inlined]
│      [4] (::REPLExt.var"#2#5"{String, Int64, UnitRange{Int64}})(x::String)
│        @ REPLExt C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Pkg\ext\REPLExt\completions.jl:40
│      [5] filter!(f::REPLExt.var"#2#5"{String, Int64, UnitRange{Int64}}, a::Vector{String})
│        @ Base .\array.jl:2912
│      [6] complete_expanded_local_dir(s::String, i1::Int64, i2::Int64, expanded_user::Bool, oldi2::Int64)
│        @ REPLExt C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Pkg\ext\REPLExt\completions.jl:40
│      [7] complete_local_dir(s::String, i1::Int64, i2::Int64)
│        @ REPLExt C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Pkg\ext\REPLExt\completions.jl:33
│      [8] complete_add_dev(options::Dict{Symbol, Any}, partial::String, i1::Int64, i2::Int64)
│        @ REPLExt C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Pkg\ext\REPLExt\completions.jl:140
│      [9] (::Pkg.REPLMode.var"#33#34"{Symbol})(opts::Dict{Symbol, Any}, partial::String, offset::Int64, index::Int64)
│        @ Pkg.REPLMode C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Pkg\src\REPLMode\command_declarations.jl:8
│     [10] complete_argument(spec::Pkg.REPLMode.CommandSpec, options::Vector{String}, partial::String, offset::Int64, index::Int64)
│        @ REPLExt C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Pkg\ext\REPLExt\completions.jl:190
│     [11] _completions(input::String, final::Bool, offset::Int64, index::Int64)
│        @ REPLExt C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Pkg\ext\REPLExt\completions.jl:216
│     [12] completions(full::String, index::Int64)
│        @ REPLExt C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Pkg\ext\REPLExt\completions.jl:247
│     [13] complete_line(c::REPLExt.PkgCompletionProvider, s::REPL.LineEdit.PromptState)
│        @ REPLExt C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Pkg\ext\REPLExt\REPLExt.jl:29
│     [14] complete_line(c::REPL.LineEdit.CompletionProvider, s::Any, ::Module)
│        @ REPL.LineEdit C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:187
│     [15] check_for_hint(s::REPL.LineEdit.MIState)
│        @ REPL.LineEdit C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:384
│     [16] (::REPL.LineEdit.var"#139#195")(s::REPL.LineEdit.MIState, data::Any, c::Union{Char, SubString{String}, String})
│        @ REPL.LineEdit C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:2520
│     [17] #invokelatest#2
│        @ .\essentials.jl:1030 [inlined]
│     [18] invokelatest
│        @ .\essentials.jl:1027 [inlined]
│     [19] (::REPL.LineEdit.var"#27#28"{REPL.LineEdit.var"#139#195", String})(s::Any, p::Any)
│        @ REPL.LineEdit C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:1704
│     [20] prompt!(term::REPL.Terminals.TextTerminal, prompt::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
│        @ REPL.LineEdit C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:2841
│     [21] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
│        @ REPL.LineEdit C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:2743
│     [22] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
│        @ REPL C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:1407
│     [23] (::REPL.var"#75#81"{REPL.LineEditREPL, REPL.REPLBackendRef})()
│        @ REPL C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\REPL.jl:457
└ @ REPL.LineEdit C:\Users\eamsmao\.julia\juliaup\julia-1.11.0-beta1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\REPL\src\LineEdit.jl:2843

I am not sure if this error is related to this issue. Here is my setup:

julia> versioninfo()
Julia Version 1.11.0-beta1
Commit 08e1fc0abb (2024-04-10 08:40 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, tigerlake)
Threads: 8 default, 0 interactive, 4 GC (on 8 virtual cores)
Environment:
  JULIA_NUM_THREADS = auto
numbermaniac commented 4 days ago

Another thing I noticed is that, if I do @eval using OhMyREPL a second time to make it work (as mentioned in my first comment), it breaks the ability to hit ] to enter the Pkg REPL. Instead, it just types a ] into the Julia REPL now.

The bug is also present in 1.11.0-rc1.