Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdlib/REPL/src/REPLCompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ function complete_keyword_argument(partial, last_idx, context_module)
# take many seconds to run over the thousands of possible methods. Note that
# isabstracttype would return naively return true for common constructor calls
# like Array, but the REPL's introspection here may know their Type{T}.
isconcretetype(funct) || return fail
isconcretetype(funct) || (Base.isType(funct) && !isabstracttype(funct.parameters[1])) || return fail
complete_methods!(methods, funct, Any[Vararg{Any}], kwargs_ex, -1, kwargs_flag == 1)
# TODO: use args_ex instead of Any[Vararg{Any}] and only provide kwarg completion for
# method calls compatible with the current arguments.
Expand Down
28 changes: 28 additions & 0 deletions stdlib/REPL/test/replcompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2330,3 +2330,31 @@ f54131 = F54131()
@test_broken REPLCompletions.KeywordArgumentCompletion("kwarg") in a
@test (@elapsed completions(s, lastindex(s), @__MODULE__, false)) < 1
end

@kwdef struct T59244
asdf = 1
qwer = 2
end
@kwdef struct S59244{T}
asdf::T = 1
qwer::T = 2
end
@testset "kwarg completion of types" begin
s = "T59244(as"
a, b, c = completions(s, lastindex(s), @__MODULE__, #= shift =# false)
@test REPLCompletions.KeywordArgumentCompletion("asdf") in a

s = "T59244(; qw"
a, b, c = completions(s, lastindex(s), @__MODULE__, #= shift =# false)
@test REPLCompletions.KeywordArgumentCompletion("qwer") in a
@test REPLCompletions.KeywordArgumentCompletion("qwer") == only(a)

s = "S59244(as"
a, b, c = completions(s, lastindex(s), @__MODULE__, #= shift =# false)
@test REPLCompletions.KeywordArgumentCompletion("asdf") in a

s = "S59244(; qw"
a, b, c = completions(s, lastindex(s), @__MODULE__, #= shift =# false)
@test REPLCompletions.KeywordArgumentCompletion("qwer") in a
@test REPLCompletions.KeywordArgumentCompletion("qwer") == only(a)
end