KristofferC / OhMyREPL.jl

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

Show tab complete hints, if supported #330

Closed IanButterworth closed 11 months ago

IanButterworth commented 1 year ago

Adds tab completion hints that landed in https://github.com/JuliaLang/julia/pull/51229

aviatesk commented 1 year ago

Could you please revive this PR? Otherwise the tab complete hints are not available for users of OhMyREPL.

IanButterworth commented 1 year ago

Tested locally and working on

julia> versioninfo()
Julia Version 1.11.0-DEV.583
Commit ca862df7bf (2023-09-30 21:12 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin23.0.0)
  CPU: 10 × Apple M2 Pro
  WORD_SIZE: 64
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
  Threads: 1 on 6 virtual cores
aviatesk commented 1 year ago

I've confirmed that it's working on the latest master (1.11.0-DEV.586). @KristofferC Could you please merge this and release a new version?

aviatesk commented 1 year ago

I got this error while using this branch:

┌ Error: Error in the keymap
│   exception =
│    MethodError: no method matching maybe_show_hint(::REPL.LineEdit.PrefixSearchState)
│    
│    Closest candidates are:
│      maybe_show_hint(::REPL.LineEdit.PromptState)
│       @ REPL ~/julia/julia1/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:476
│    
│    Stacktrace:
│      [1] rewrite_with_ANSI(s::Any, cursormove::Bool)
│        @ OhMyREPL.Prompt ~/julia/packages/OhMyREPL/src/repl.jl:81
│      [2] rewrite_with_ANSI(s::Any, cursormove::Bool)
│        @ OhMyREPL.Prompt ~/julia/packages/OhMyREPL/src/repl.jl:25 [inlined]
│      [3] refresh_line
│        @ ~/julia/packages/OhMyREPL/src/refresh_lines.jl:5 [inlined]
│      [4] history_move_prefix(s::REPL.LineEdit.PrefixSearchState, hist::REPL.REPLHistoryProvider, prefix::AbstractString, backwards::Bool, cur_idx::Int64)
│        @ REPL ~/julia/julia1/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:804
│      [5] history_move_prefix
│        @ REPL ~/julia/julia1/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:783 [inlined]
│      [6] history_prev_prefix(s::REPL.LineEdit.PrefixSearchState, hist::REPL.REPLHistoryProvider, prefix::AbstractString)
│        @ REPL ~/julia/julia1/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:816
│      [7] enter_prefix_search(s::REPL.LineEdit.MIState, p::REPL.LineEdit.PrefixHistoryPrompt, backward::Bool)
│        @ REPL.LineEdit ~/julia/julia1/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:0
│      [8] (::REPL.LineEdit.var"#262#266"{REPL.LineEdit.PrefixHistoryPrompt})(::REPL.LineEdit.MIState, ::Any, ::Vararg{Any})
│        @ REPL.LineEdit ~/julia/julia1/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2598
│      [9] #invokelatest#2
│        @ Base ./essentials.jl:899 [inlined]
│     [10] invokelatest
│        @ Base ./essentials.jl:896 [inlined]
│     [11] (::REPL.LineEdit.var"#27#28"{REPL.LineEdit.var"#262#266"{REPL.LineEdit.PrefixHistoryPrompt}, String})(s::Any, p::Any)
│        @ REPL.LineEdit ~/julia/julia1/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:1670
│     [12] prompt!(term::REPL.Terminals.TextTerminal, prompt::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
│        @ REPL.LineEdit ~/julia/julia1/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2807
│     [13] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
│        @ REPL.LineEdit ~/julia/julia1/usr/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2709
│     [14] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
│        @ REPL ~/julia/julia1/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:1339
│     [15] (::REPL.var"#64#70"{REPL.LineEditREPL, REPL.REPLBackendRef})()

Could this be fixed?

KristofferC commented 11 months ago

I think the latest commit should address that issue @aviatesk

aviatesk commented 11 months ago

Thanks!