@@ -1225,33 +1225,35 @@ function completions(string::String, pos::Int, context_module::Module=Main, shif
12251225 partial = string[1 : pos]
12261226 inc_tag = Base. incomplete_tag (Meta. parse (partial, raise= false , depwarn= false ))
12271227
1228- # ?(x, y)TAB lists methods you can call with these objects
1229- # ?(x, y TAB lists methods that take these objects as the first two arguments
1230- # MyModule.?(x, y)TAB restricts the search to names in MyModule
1231- rexm = match (r" (\w +\. |)\?\( (.*)$" , partial)
1232- if rexm != = nothing
1233- # Get the module scope
1234- if isempty (rexm. captures[1 ])
1235- callee_module = context_module
1236- else
1237- modname = Symbol (rexm. captures[1 ][1 : end - 1 ])
1238- if isdefined (context_module, modname)
1239- callee_module = getfield (context_module, modname)
1240- if ! isa (callee_module, Module)
1228+ if ! hint # require a tab press for completion of these
1229+ # ?(x, y)TAB lists methods you can call with these objects
1230+ # ?(x, y TAB lists methods that take these objects as the first two arguments
1231+ # MyModule.?(x, y)TAB restricts the search to names in MyModule
1232+ rexm = match (r" (\w +\. |)\?\( (.*)$" , partial)
1233+ if rexm != = nothing
1234+ # Get the module scope
1235+ if isempty (rexm. captures[1 ])
1236+ callee_module = context_module
1237+ else
1238+ modname = Symbol (rexm. captures[1 ][1 : end - 1 ])
1239+ if isdefined (context_module, modname)
1240+ callee_module = getfield (context_module, modname)
1241+ if ! isa (callee_module, Module)
1242+ callee_module = context_module
1243+ end
1244+ else
12411245 callee_module = context_module
12421246 end
1243- else
1244- callee_module = context_module
12451247 end
1246- end
1247- moreargs = ! endswith ( rexm. captures[2 ], ' ) ' )
1248- callstr = " _( " * rexm . captures[ 2 ]
1249- if moreargs
1250- callstr *= ' ) '
1251- end
1252- ex_org = Meta . parse (callstr, raise = false , depwarn = false )
1253- if isa (ex_org, Expr)
1254- return complete_any_methods (ex_org, callee_module :: Module , context_module, moreargs, shift), ( 0 : length (rexm . captures[ 1 ]) + 1 ) .+ rexm . offset, false
1248+ moreargs = ! endswith (rexm . captures[ 2 ], ' ) ' )
1249+ callstr = " _( " * rexm. captures[2 ]
1250+ if moreargs
1251+ callstr *= ' ) '
1252+ end
1253+ ex_org = Meta . parse (callstr, raise = false , depwarn = false )
1254+ if isa (ex_org, Expr )
1255+ return complete_any_methods (ex_org, callee_module :: Module , context_module, moreargs, shift), ( 0 : length (rexm . captures[ 1 ]) + 1 ) .+ rexm . offset, false
1256+ end
12551257 end
12561258 end
12571259
0 commit comments