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

Autocompletion triggers error in invalid AbstractDict #54892

Open
jakobnissen opened this issue Jun 22, 2024 · 0 comments
Open

Autocompletion triggers error in invalid AbstractDict #54892

jakobnissen opened this issue Jun 22, 2024 · 0 comments

Comments

@jakobnissen
Copy link
Contributor

So, this may or may not be intended behaviour.
I'm writing a package with a new AbstractDict type, which is lazily validated. That means its possible to construct an invalid instance (which may be checked with isvalid). Encountering an invalid value when iterating the dict, or accessing an invalid key will throw an exception.
Problem is, the REPL will access the dictionary while giving autocomplete suggestions (see below)

Is this a problem? Maybe it's fair to assume iterating an AbstractDict never errors.

julia> aux["K┌ Error: Error in the keymap
│   exception =
│    Bad AuxTag
│    Stacktrace:
│      [1] error(s::String)
│        @ Base ./error.jl:44
│      [2] (::XAMAuxData.var"#5#6")(val::XAMAuxData.Errors.Error)
│        @ XAMAuxData ~/code/XAMAuxData.jl/src/XAMAuxData.jl:213
│      [3] iterate
│        @ ./generator.jl:48 [inlined]
│      [4] find_dict_matches(identifier::XAMAuxData.BAM.Auxiliary{MemViews.ImmutableMemView{UInt8}}, partial_key::String)
│        @ REPL.REPLCompletions ~/code/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPLCompletions.jl:1000
│      [5] completions(string::String, pos::Int64, context_module::Module, shift::Bool, hint::Bool)
│        @ REPL.REPLCompletions ~/code/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPLCompletions.jl:1249
│      [6] complete_line(c::REPL.REPLCompletionProvider, s::REPL.LineEdit.PromptState, mod::Module; hint::Bool)
│        @ REPL ~/code/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:659
│      [7] check_for_hint(s::REPL.LineEdit.MIState)
│        @ REPL.LineEdit ~/code/julia/usr/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:384
│      [8] (::REPL.LineEdit.var"#143#199")(s::REPL.LineEdit.MIState, data::Any, c::Union{Char, SubString{String}, String})
│        @ REPL.LineEdit ~/code/julia/usr/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2520
│      [9] #invokelatest#2
│        @ ./essentials.jl:1045 [inlined]
│     [10] invokelatest
│        @ ./essentials.jl:1042 [inlined]
│     [11] (::REPL.LineEdit.var"#30#31"{REPL.LineEdit.var"#143#199", String})(s::Any, p::Any)
│        @ REPL.LineEdit ~/code/julia/usr/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:1704
│     [12] macro expansion
│        @ ~/code/julia/usr/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2854 [inlined]
│     [13] macro expansion
│        @ ./lock.jl:273 [inlined]
│     [14] (::REPL.LineEdit.var"#282#284"{REPL.Terminals.TTYTerminal, REPL.LineEdit.ModalInterface, REPL.LineEdit.MIState, ReentrantLock, REPL.LineEdit.Prompt})()
│        @ REPL.LineEdit ~/code/julia/usr/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2844
└ @ REPL.LineEdit ~/code/julia/usr/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2856
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

1 participant