Skip to content

Commit ad4c897

Browse files
committed
prevent iex process termination when autocomplete on a single dot (.)
1 parent 7120a5e commit ad4c897

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/iex/lib/iex/autocomplete.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ defmodule IEx.Autocomplete do
5151

5252
def expand([h|t]=expr) do
5353
cond do
54-
h === ?. ->
54+
h === ?. and t != []->
5555
expand_dot reduce(t)
5656
h === ?: ->
5757
expand_erlang_modules

lib/iex/test/iex/autocomplete_test.exs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ defmodule IEx.AutocompleteTest do
2121
end
2222

2323
test :erlang_module_multiple_values_completion do
24-
{:yes, '', list} = expand(':user')
24+
{:yes, '', list} = expand(':user')
2525
assert length(list) > 1
2626
end
2727

@@ -35,6 +35,7 @@ defmodule IEx.AutocompleteTest do
3535
end
3636

3737
test :elixir_no_completion do
38+
assert expand('.') == {:no, '', []}
3839
assert expand('Xyz') == {:no, '', []}
3940
end
4041

@@ -48,7 +49,7 @@ defmodule IEx.AutocompleteTest do
4849
end
4950

5051
test :elixir_submodule_no_completion do
51-
assert expand('IEx.Xyz') == {:no, '', []}
52+
assert expand('IEx.Xyz') == {:no, '', []}
5253
end
5354

5455
test :elixir_function_completion do

0 commit comments

Comments
 (0)