Skip to content

Commit

Permalink
REPL: tab completion for non-struct types (JuliaLang#41679)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArunS-tack authored and LilithHafner committed Mar 8, 2022
1 parent 5ccf6e6 commit f3da35a
Show file tree
Hide file tree
Showing 2 changed files with 10 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 @@ -144,7 +144,7 @@ function complete_symbol(sym::String, ffunc, context_module::Module=Main)
if isa(b, Module)
mod = b
lookup_module = true
elseif Base.isstructtype(typeof(b))
else
lookup_module = false
t = typeof(b)
end
Expand Down
9 changes: 9 additions & 0 deletions stdlib/REPL/test/replcompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ let ex = quote
:()
end

primitive type NonStruct 8 end
Base.propertynames(::NonStruct) = (:a, :b, :c)
x = reinterpret(NonStruct, 0x00)

# Support non-Dict AbstractDicts, #19441
mutable struct CustomDict{K, V} <: AbstractDict{K, V}
mydict::Dict{K, V}
Expand Down Expand Up @@ -1145,6 +1149,11 @@ let s = "test_dict[\"ab"
@test c == Any["\"abc\"", "\"abcd\""]
end

let s = "CompletionFoo.x."
c, r = test_complete(s)
@test "a" in c
end

# https://github.com/JuliaLang/julia/issues/27184
let
(test_complete("@noexist."); @test true)
Expand Down

0 comments on commit f3da35a

Please sign in to comment.