Skip to content

Commit 1fddcf2

Browse files
committed
Revert "Re-enable tab completion of kwargs for large method tables (#58012)"
This reverts commit f673211.
1 parent ef6d035 commit 1fddcf2

File tree

2 files changed

+1
-36
lines changed

2 files changed

+1
-36
lines changed

stdlib/REPL/src/REPLCompletions.jl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -949,13 +949,7 @@ function complete_keyword_argument(partial, last_idx, context_module)
949949
kwargs_flag == 2 && return fail # one of the previous kwargs is invalid
950950

951951
methods = Completion[]
952-
# Limit kwarg completions to cases when function is concretely known; looking up
953-
# matching methods for abstract functions — particularly `Any` or `Function` — can
954-
# take many seconds to run over the thousands of possible methods. Note that
955-
# isabstracttype would return naively return true for common constructor calls
956-
# like Array, but the REPL's introspection here may know their Type{T}.
957-
isconcretetype(funct) || return false
958-
complete_methods!(methods, funct, Any[Vararg{Any}], kwargs_ex, -1, kwargs_flag == 1)
952+
complete_methods!(methods, funct, Any[Vararg{Any}], kwargs_ex, MAX_METHOD_COMPLETIONS, kwargs_flag == 1)
959953
# TODO: use args_ex instead of Any[Vararg{Any}] and only provide kwarg completion for
960954
# method calls compatible with the current arguments.
961955

stdlib/REPL/test/replcompletions.jl

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,32 +2004,3 @@ let s = "using ...Issue52922.Inn"
20042004
@test res
20052005
@test "Inner2" in c
20062006
end
2007-
2008-
function g54131 end
2009-
for i in 1:498
2010-
@eval g54131(::Val{$i}) = i
2011-
end
2012-
g54131(::Val{499}; kwarg=true) = 499*kwarg
2013-
struct F54131; end
2014-
Base.getproperty(::F54131, ::Symbol) = Any[cos, sin, g54131][rand(1:3)]
2015-
f54131 = F54131()
2016-
@testset "performance of kwarg completion with large method tables" begin
2017-
# The goal here is to simply ensure we aren't hitting catestrophically bad
2018-
# behaviors when shift isn't pressed. The difference between good and bad
2019-
# is on the order of tens of milliseconds vs tens of seconds; using 1 sec as
2020-
# a very rough canary that is hopefully robust even in the noisy CI coalmines
2021-
s = "g54131(kwa"
2022-
a, b, c = completions(s, lastindex(s), @__MODULE__, #= shift =# false)
2023-
@test REPLCompletions.KeywordArgumentCompletion("kwarg") in a
2024-
@test (@elapsed completions(s, lastindex(s), @__MODULE__, false)) < 1
2025-
2026-
s = "f54131.x("
2027-
a, b, c = completions(s, lastindex(s), @__MODULE__, false)
2028-
@test only(a) isa REPLCompletions.TextCompletion
2029-
@test (@elapsed completions(s, lastindex(s), @__MODULE__, false)) < 1
2030-
2031-
s = "f54131.x(kwa"
2032-
a, b, c = completions(s, lastindex(s), @__MODULE__, false)
2033-
@test_broken REPLCompletions.KeywordArgumentCompletion("kwarg") in a
2034-
@test (@elapsed completions(s, lastindex(s), @__MODULE__, false)) < 1
2035-
end

0 commit comments

Comments
 (0)