Skip to content

Commit

Permalink
fix dict replcompletion error without key (#28352)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfitzseb authored and KristofferC committed Jul 30, 2018
1 parent 0432866 commit 0fb00c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/REPL/src/REPLCompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ function dict_identifier_key(str,tag)
# Avoid `isdefined(::Array, ::Symbol)`
isa(obj, Array) && return (nothing, nothing, nothing)
end
begin_of_key = first(findnext(r"\S", str, nextind(str, end_of_identifier) + 1)) # 1 for [
begin_of_key = first(something(findnext(r"\S", str, nextind(str, end_of_identifier) + 1), 1)) # 1 for [
begin_of_key==0 && return (true, nothing, nothing)
partial_key = str[begin_of_key:end]
(isa(obj, AbstractDict) && length(obj) < 1e6) || return (true, nothing, nothing)
Expand Down
3 changes: 3 additions & 0 deletions stdlib/REPL/test/replcompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,9 @@ function test_dict_completion(dict_name)
s = "$dict_name[:α"
c, r = test_complete(s)
@test c == Any[":α]"]
s = "$dict_name["
c, r = test_complete(s)
@test !isempty(c)
end
test_dict_completion("CompletionFoo.test_dict")
test_dict_completion("CompletionFoo.test_customdict")
Expand Down

0 comments on commit 0fb00c9

Please sign in to comment.