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

With bracket auto-complete disabled: Error in the keymap: EOFError: read end of file #314

Open
glm729 opened this issue Mar 26, 2023 · 4 comments

Comments

@glm729
Copy link

glm729 commented Mar 26, 2023

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
@KristofferC
Copy link
Owner

Thanks, this seems to be a bug with the new parser we changed to. Will file an upstream issue.

@KristofferC
Copy link
Owner

@KristofferC
Copy link
Owner

JuliaLang/JuliaSyntax.jl#233 should fix it I thjink

@glm729
Copy link
Author

glm729 commented Mar 28, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants