@@ -966,7 +966,7 @@ function complete_identifiers!(suggestions::Vector{Completion}, @nospecialize(ff
966966 append! (suggestions, complete_keyval (name))
967967 end
968968 if dotpos > 1 && string[dotpos] == ' .'
969- s = string[1 : dotpos- 1 ]
969+ s = string[1 : prevind (string, dotpos) ]
970970 # First see if the whole string up to `pos` is a valid expression. If so, use it.
971971 ex = Meta. parse (s, raise= false , depwarn= false )
972972 if isexpr (ex, :incomplete )
@@ -1005,6 +1005,17 @@ function complete_identifiers!(suggestions::Vector{Completion}, @nospecialize(ff
10051005 ex = Meta. parse (lookup_name, raise= false , depwarn= false )
10061006 end
10071007 isexpr (ex, :incomplete ) && (ex = nothing )
1008+ elseif isexpr (ex, :call ) && length (ex. args) > 1
1009+ isinfix = s[end ] != ' )'
1010+ # A complete call expression that does not finish with ')' is an infix call.
1011+ if ! isinfix
1012+ # Handle infix call argument completion of the form bar + foo(qux).
1013+ frange, end_of_identifier = find_start_brace (@view s[1 : end - 1 ])
1014+ isinfix = Meta. parse (@view (s[frange[1 ]: end ]), raise= false , depwarn= false ) == ex. args[end ]
1015+ end
1016+ if isinfix
1017+ ex = ex. args[end ]
1018+ end
10081019 end
10091020 end
10101021 append! (suggestions, complete_symbol (ex, name, ffunc, context_module))
0 commit comments