@@ -506,7 +506,7 @@ function complete_methods(ex_org::Expr, context_module::Module=Main)
506506 return out
507507end
508508
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 )
510510 out = Completion[]
511511 args_ex, kwargs_ex = try
512512 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
533533 end
534534 end
535535
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+
536545 return out
537546end
538547
@@ -719,7 +728,7 @@ function project_deps_get_completion_candidates(pkgstarts::String, project_file:
719728 return Completion[PackageCompletion (name) for name in loading_candidates]
720729end
721730
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 )
723732 # First parse everything up to the current position
724733 partial = string[1 : pos]
725734 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)
750759 end
751760 ex_org = Meta. parse (callstr, raise= false , depwarn= false )
752761 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
754763 end
755764 end
756765
0 commit comments