@@ -179,7 +179,7 @@ defmodule IEx.Autocomplete do
179
179
defp match_aliases ( hint ) do
180
180
for { alias , _mod } <- env_aliases ( ) ,
181
181
[ name ] = Module . split ( alias ) ,
182
- String . starts_with? ( name , hint ) do
182
+ starts_with? ( name , hint ) do
183
183
% { kind: :module , type: :alias , name: name }
184
184
end
185
185
end
@@ -201,8 +201,8 @@ defmodule IEx.Autocomplete do
201
201
defp match_modules ( hint , root ) do
202
202
get_modules ( root )
203
203
|> :lists . usort ( )
204
- |> Enum . drop_while ( & not String . starts_with? ( & 1 , hint ) )
205
- |> Enum . take_while ( & String . starts_with? ( & 1 , hint ) )
204
+ |> Enum . drop_while ( & not starts_with? ( & 1 , hint ) )
205
+ |> Enum . take_while ( & starts_with? ( & 1 , hint ) )
206
206
end
207
207
208
208
defp get_modules ( true ) do
@@ -247,7 +247,7 @@ defmodule IEx.Autocomplete do
247
247
248
248
for { fun , arities } <- list ,
249
249
name = Atom . to_string ( fun ) ,
250
- String . starts_with? ( name , hint ) do
250
+ starts_with? ( name , hint ) do
251
251
% { kind: :function , name: name , arities: arities }
252
252
end |> :lists . sort ( )
253
253
@@ -271,6 +271,9 @@ defmodule IEx.Autocomplete do
271
271
defp ensure_loaded ( mod ) ,
272
272
do: Code . ensure_compiled ( mod )
273
273
274
+ defp starts_with? ( _string , "" ) , do: true
275
+ defp starts_with? ( string , hint ) , do: String . starts_with? ( string , hint )
276
+
274
277
## Ad-hoc conversions
275
278
276
279
defp to_entries ( % { kind: :module , name: name } ) do
0 commit comments