Skip to content

Commit cf8c28c

Browse files
committed
Fix autocompletion on Erlang/OTP 26, closes #13307
1 parent 60dcd14 commit cf8c28c

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

lib/iex/lib/iex/autocomplete.ex

+1-3
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,7 @@ defmodule IEx.Autocomplete do
197197
end
198198

199199
defp expand_signatures([_ | _] = signatures, _shell) do
200-
[head | tail] = Enum.sort(signatures, &(String.length(&1) <= String.length(&2)))
201-
if tail != [], do: IO.write("\n" <> (tail |> Enum.reverse() |> Enum.join("\n")))
202-
yes("", [head])
200+
yes("", Enum.sort_by(signatures, &String.length/1))
203201
end
204202

205203
defp expand_signatures([], shell), do: expand_local_or_var("", shell)

lib/iex/test/iex/autocomplete_test.exs

+2-5
Original file line numberDiff line numberDiff line change
@@ -492,11 +492,8 @@ defmodule IEx.AutocompleteTest do
492492

493493
eval("import Enum; import Protocol")
494494

495-
assert ExUnit.CaptureIO.capture_io(fn ->
496-
send(self(), expand(~c"reduce("))
497-
end) == "\nreduce(enumerable, acc, fun)"
498-
499-
assert_received {:yes, ~c"", [~c"reduce(enumerable, fun)"]}
495+
assert expand(~c"reduce(") ==
496+
{:yes, ~c"", [~c"reduce(enumerable, fun)", ~c"reduce(enumerable, acc, fun)"]}
500497

501498
assert expand(~c"take(") == {:yes, ~c"", [~c"take(enumerable, amount)"]}
502499
assert expand(~c"derive(") == {:yes, ~c"", [~c"derive(protocol, module, options \\\\ [])"]}

0 commit comments

Comments
 (0)