OhMyREPL.jl
OhMyREPL.jl copied to clipboard
With bracket auto-complete disabled: `Error in the keymap: EOFError: read end of file`
When typing an escaped single-quoted character after running enable_autocomplete_brackets(false)
, an exception is raised on entering the slash. For example, when entering '\t'
:
julia> '┌ Error: Error in the keymap
│ exception =
│ EOFError: read end of file
│ Stacktrace:
│ [1] read
│ @ ./iobuffer.jl:217 [inlined]
│ [2] read
│ @ ./io.jl:787 [inlined]
│ [3] validate_tokens(stream::JuliaSyntax.ParseStream)
│ @ JuliaSyntax ~/.julia/packages/JuliaSyntax/EGQXe/src/parse_stream.jl:903
│ [4] parse!(stream::JuliaSyntax.ParseStream; rule::Symbol)
│ @ JuliaSyntax ~/.julia/packages/JuliaSyntax/EGQXe/src/parser_api.jl:54
│ [5] tokenize(text::String)
│ @ JuliaSyntax ~/.julia/packages/JuliaSyntax/EGQXe/src/parser_api.jl:181
│ [6] rewrite_with_ANSI(s::Any, cursormove::Bool)
│ @ OhMyREPL.Prompt ~/.julia/packages/OhMyREPL/zRJyJ/src/repl.jl:67
│ [7] rewrite_with_ANSI
│ @ ~/.julia/packages/OhMyREPL/zRJyJ/src/repl.jl:25 [inlined]
│ [8] (::OhMyREPL.Prompt.var"#2#29")(s::Any, data::Any, c::Any)
│ @ OhMyREPL.Prompt ~/.julia/packages/OhMyREPL/zRJyJ/src/repl.jl:90
│ [9] #invokelatest#2
│ @ ./essentials.jl:729 [inlined]
│ [10] invokelatest
│ @ ./essentials.jl:726 [inlined]
│ [11] (::REPL.LineEdit.var"#25#26"{OhMyREPL.Prompt.var"#2#29", String})(s::Any, p::Any)
│ @ REPL.LineEdit /usr/local/share/julia-1.8.3/share/julia/stdlib/v1.8/REPL/src/LineEdit.jl:1472
│ [12] prompt!(term::REPL.Terminals.TextTerminal, prompt::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
│ @ REPL.LineEdit /usr/local/share/julia-1.8.3/share/julia/stdlib/v1.8/REPL/src/LineEdit.jl:2603
│ [13] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
│ @ REPL.LineEdit /usr/local/share/julia-1.8.3/share/julia/stdlib/v1.8/REPL/src/LineEdit.jl:2505
│ [14] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
│ @ REPL /usr/local/share/julia-1.8.3/share/julia/stdlib/v1.8/REPL/src/REPL.jl:1248
│ [15] (::REPL.var"#49#54"{REPL.LineEditREPL, REPL.REPLBackendRef})()
│ @ REPL ./task.jl:484
└ @ REPL.LineEdit /cache/build/default-amdci5-6/julialang/julia-release-1-dot-8/usr/share/julia/stdlib/v1.8/REPL/src/LineEdit.jl:2605
julia>
julia>
This does not occur with a double-quoted string:
julia> "\t"
"\t"
The error does not occur with a "bare" REPL. It also doesn't occur when running without the startup script then calling using OhMyREPL
and colorscheme!
. It appears to be caused by enable_autocomplete_brackets(false)
, as the error occurs after calling this function.
startup.jl
:
atreplinit() do repl
try
@eval using OhMyREPL
@eval colorscheme!("TomorrowNightBright")
@eval enable_autocomplete_brackets(false)
@eval OhMyREPL.Passes.RainbowBrackets.activate_16colors()
@eval enable_highlight_markdown(true)
catch e
@warn "Error loading OhMyREPL" e
end
end
Thanks, this seems to be a bug with the new parser we changed to. Will file an upstream issue.
https://github.com/JuliaLang/JuliaSyntax.jl/issues/232
https://github.com/JuliaLang/JuliaSyntax.jl/pull/233 should fix it I thjink
Thank you for the very quick response!
In the interim, I've been using strings, e.g. split(table_row, "\t")
, but using a character in scripts. I'm not sure how much practical difference this makes to runtime and memory, but I wouldn't expect any testing in the REPL to be hyper-optimised in any case.
Love the project, and thank you again!