@@ -353,7 +353,7 @@ get_value(sym, fn) = (sym, true)
353
353
function get_value_getfield (ex:: Expr , fn)
354
354
# Example :((top(getfield))(Base,:max))
355
355
val, found = get_value_getfield (ex. args[2 ],fn) # Look up Base in Main and returns the module
356
- found || return (nothing , false )
356
+ ( found && length (ex . args) >= 3 ) || return (nothing , false )
357
357
return get_value_getfield (ex. args[3 ], val) # Look up max in Base and returns the function if found.
358
358
end
359
359
get_value_getfield (sym, fn) = get_value (sym, fn)
@@ -407,7 +407,7 @@ function try_get_type(sym::Expr, fn::Module)
407
407
elseif sym. head === :ref
408
408
# some simple cases of `expand`
409
409
return try_get_type (Expr (:call , GlobalRef (Base, :getindex ), sym. args... ), fn)
410
- elseif sym. head === :.
410
+ elseif sym. head === :. && sym . args[ 2 ] isa QuoteNode # second check catches broadcasting
411
411
return try_get_type (Expr (:call , GlobalRef (Core, :getfield ), sym. args... ), fn)
412
412
end
413
413
return (Any, false )
@@ -432,10 +432,21 @@ function complete_methods(ex_org::Expr, context_module=Main)::Vector{Completion}
432
432
args_ex = Any[]
433
433
func, found = get_value (ex_org. args[1 ], context_module)
434
434
! found && return Completion[]
435
- for ex in ex_org. args[2 : end ]
436
- val, found = get_type (ex, context_module)
437
- push! (args_ex, val)
435
+
436
+ funargs = ex_org. args[2 : end ]
437
+ # handle broadcasting, but only handle number of arguments instead of
438
+ # argument types
439
+ if ex_org. head === :. && ex_org. args[2 ] isa Expr
440
+ for _ in ex_org. args[2 ]. args
441
+ push! (args_ex, Any)
442
+ end
443
+ else
444
+ for ex in funargs
445
+ val, found = get_type (ex, context_module)
446
+ push! (args_ex, val)
447
+ end
438
448
end
449
+
439
450
out = Completion[]
440
451
t_in = Tuple{Core. Typeof (func), args_ex... } # Input types
441
452
na = length (args_ex)+ 1
@@ -610,12 +621,16 @@ function completions(string, pos, context_module=Main)::Completions
610
621
611
622
# Make sure that only bslash_completions is working on strings
612
623
inc_tag== :string && return String[], 0 : - 1 , false
613
-
614
624
if inc_tag == :other && should_method_complete (partial)
615
625
frange, method_name_end = find_start_brace (partial)
616
626
ex = Meta. parse (partial[frange] * " )" , raise= false , depwarn= false )
617
- if isa (ex, Expr) && ex. head== :call
618
- return complete_methods (ex, context_module), first (frange): method_name_end, false
627
+
628
+ if isa (ex, Expr)
629
+ if ex. head== :call
630
+ return complete_methods (ex, context_module), first (frange): method_name_end, false
631
+ elseif ex. head== :. && ex. args[2 ] isa Expr && ex. args[2 ]. head== :tuple
632
+ return complete_methods (ex, context_module), first (frange): (method_name_end - 1 ), false
633
+ end
619
634
end
620
635
elseif inc_tag == :comment
621
636
return Completion[], 0 : - 1 , false
0 commit comments