5454
5555
5656const JULIA_UUID = UUID (" 1222c4b2-2114-5bfd-aeef-88e4692bbb3e" )
57- function complete_remote_package ( partial; hint:: Bool )
58- found_match = false
59- isempty (partial) && return String[]
57+ function complete_remote_package! (comps, partial; hint:: Bool )
58+ isempty (partial) && return true # true means returned early
59+ found_match = ! isempty (comps)
6060 cmp = Set {String} ()
6161 for reg in Registry. reachable_registries ()
6262 for (uuid, regpkg) in reg
@@ -80,9 +80,9 @@ function complete_remote_package(partial; hint::Bool)
8080 if is_julia_compat === nothing || is_julia_compat
8181 push! (cmp, name)
8282 # In hint mode the result is only used if there is a single matching entry
83- # so we abort the search
83+ # so we can return no matches in case of more than one match
8484 if hint && found_match
85- return sort! ( collect (cmp))
85+ return true # true means returned early
8686 end
8787 found_match = true
8888 break
@@ -91,7 +91,8 @@ function complete_remote_package(partial; hint::Bool)
9191 end
9292 end
9393 end
94- return sort! (collect (cmp))
94+ append! (comps, sort! (collect (cmp)))
95+ return false # false means performed full search
9596end
9697
9798function complete_help (options, partial; hint:: Bool )
@@ -149,8 +150,9 @@ function complete_add_dev(options, partial, i1, i2; hint::Bool)
149150 if occursin (Base. Filesystem. path_separator_re, partial)
150151 return comps, idx, ! isempty (comps)
151152 end
152- comps = vcat (comps, sort (complete_remote_package (partial; hint)))
153- if ! isempty (partial)
153+ returned_early = complete_remote_package! (comps, partial; hint)
154+ # returning early means that no further search should be done here
155+ if ! returned_early
154156 append! (comps, filter! (startswith (partial), [info. name for info in values (Types. stdlib_infos ())]))
155157 end
156158 return comps, idx, ! isempty (comps)
0 commit comments