KristofferC / OhMyREPL.jl

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

Error printing Markdown #257

Closed mtfishman closed 2 years ago

mtfishman commented 2 years ago

Hi,

I came across the following error when printing a simple Markdown string when OhMyREPL is loaded:

julia> using Markdown

julia> md"""
   <--
   ```
   """

<--

julia> using OhMyREPL

julia> md"""

       <--
   """

Error showing value of type Markdown.MD: ERROR: KeyError: key Tokenize.Tokens.LEFT_ARROW not found Stacktrace: [1] getindex @ ./dict.jl:481 [inlined] [2] untokenize(t::Tokenize.Tokens.Token) @ Tokenize.Tokens ~/.julia/packages/Tokenize/FGrTw/src/token.jl:111 [3] term(io::IOContext{Base.TTY}, md::Markdown.Code, columns::Int64) @ OhMyREPL ~/.julia/packages/OhMyREPL/07uNa/src/MarkdownHighlighter.jl:50 [4] term(io::IOContext{Base.TTY}, content::Vector{Any}, cols::Int64) @ Markdown ~/software/julia-1.7.1/share/julia/stdlib/v1.7/Markdown/src/render/terminal/render.jl:13 [5] term (repeats 2 times) @ ~/software/julia-1.7.1/share/julia/stdlib/v1.7/Markdown/src/render/terminal/render.jl:16 [inlined] [6] show(io::IOContext{Base.TTY}, #unused#::MIME{Symbol("text/plain")}, md::Markdown.MD) @ Markdown ~/software/julia-1.7.1/share/julia/stdlib/v1.7/Markdown/src/render/terminal/render.jl:176 [7] display(d::REPL.REPLDisplay{REPL.LineEditREPL}, mime::MIME{Symbol("text/plain")}, x::Markdown.MD) @ OhMyREPL ~/.julia/packages/OhMyREPL/07uNa/src/output_prompt_overwrite.jl:8 [8] display(d::REPL.REPLDisplay, x::Any) @ REPL ~/software/julia-1.7.1/share/julia/stdlib/v1.7/REPL/src/REPL.jl:269 [9] display(x::Any) @ Base.Multimedia ./multimedia.jl:328 [10] #invokelatest#2 @ ./essentials.jl:716 [inlined] [11] invokelatest @ ./essentials.jl:714 [inlined] [12] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay}) @ REPL ~/software/julia-1.7.1/share/julia/stdlib/v1.7/REPL/src/REPL.jl:291 [13] (::REPL.var"#45#46"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any) @ REPL ~/software/julia-1.7.1/share/julia/stdlib/v1.7/REPL/src/REPL.jl:275 [14] with_repl_linfo(f::Any, repl::REPL.LineEditREPL) @ REPL ~/software/julia-1.7.1/share/julia/stdlib/v1.7/REPL/src/REPL.jl:508 [15] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool) @ REPL ~/software/julia-1.7.1/share/julia/stdlib/v1.7/REPL/src/REPL.jl:273 [16] (::REPL.var"#do_respond#66"{Bool, Bool, REPL.var"#77#87"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool) @ REPL ~/software/julia-1.7.1/share/julia/stdlib/v1.7/REPL/src/REPL.jl:844 [17] #invokelatest#2 @ ./essentials.jl:716 [inlined] [18] invokelatest @ ./essentials.jl:714 [inlined] [19] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState) @ REPL.LineEdit ~/software/julia-1.7.1/share/julia/stdlib/v1.7/REPL/src/LineEdit.jl:2493 [20] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef) @ REPL ~/software/julia-1.7.1/share/julia/stdlib/v1.7/REPL/src/REPL.jl:1230 [21] (::REPL.var"#49#54"{REPL.LineEditREPL, REPL.REPLBackendRef})() @ REPL ./task.jl:423

My setup is the following:
```julia
julia> versioninfo()
Julia Version 1.7.1
Commit ac5cc99908 (2021-12-22 19:35 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) E-2176M  CPU @ 2.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)

julia> using Pkg

julia> Pkg.status()
      Status `~/Project.toml`
  [5fb14364] OhMyREPL v0.5.10
KristofferC commented 2 years ago

Thanks, looks like a bug in the Tokenize library. I'll look at it.

mtfishman commented 2 years ago

Thanks @KristofferC! Looks like it is fixed on my end.

KristofferC commented 2 years ago

Thanks for confirming