@@ -506,7 +506,7 @@ function complete_methods(ex_org::Expr, context_module::Module=Main)
506
506
return out
507
507
end
508
508
509
- function complete_any_methods (ex_org:: Expr , callee_module:: Module , context_module:: Module , moreargs:: Bool )
509
+ function complete_any_methods (ex_org:: Expr , callee_module:: Module , context_module:: Module , moreargs:: Bool , shift :: Bool )
510
510
out = Completion[]
511
511
args_ex, kwargs_ex = try
512
512
complete_methods_args (ex_org. args[2 : end ], ex_org, context_module, false , false )
@@ -533,6 +533,15 @@ function complete_any_methods(ex_org::Expr, callee_module::Module, context_modul
533
533
end
534
534
end
535
535
536
+ if ! shift
537
+ # Filter out methods where all arguments are `Any`
538
+ filter! (out) do c
539
+ isa (c, REPLCompletions. MethodCompletion) || return true
540
+ sig = Base. unwrap_unionall (c. method. sig):: DataType
541
+ return ! all (T -> T === Any || T === Vararg{Any}, sig. parameters[2 : end ])
542
+ end
543
+ end
544
+
536
545
return out
537
546
end
538
547
@@ -719,7 +728,7 @@ function project_deps_get_completion_candidates(pkgstarts::String, project_file:
719
728
return Completion[PackageCompletion (name) for name in loading_candidates]
720
729
end
721
730
722
- function completions (string:: String , pos:: Int , context_module:: Module = Main)
731
+ function completions (string:: String , pos:: Int , context_module:: Module = Main, shift :: Bool = true )
723
732
# First parse everything up to the current position
724
733
partial = string[1 : pos]
725
734
inc_tag = Base. incomplete_tag (Meta. parse (partial, raise= false , depwarn= false ))
@@ -750,7 +759,7 @@ function completions(string::String, pos::Int, context_module::Module=Main)
750
759
end
751
760
ex_org = Meta. parse (callstr, raise= false , depwarn= false )
752
761
if isa (ex_org, Expr)
753
- return complete_any_methods (ex_org, callee_module:: Module , context_module, moreargs), (0 : length (rexm. captures[1 ])+ 1 ) .+ rexm. offset, false
762
+ return complete_any_methods (ex_org, callee_module:: Module , context_module, moreargs, shift ), (0 : length (rexm. captures[1 ])+ 1 ) .+ rexm. offset, false
754
763
end
755
764
end
756
765
0 commit comments