Skip to content
Browse files

Fix a bug where a partial alias could not be expanded on iex

  • Loading branch information...
1 parent 69e36c7 commit 95286df0c4fe07ce686b249a2aaad07968d161f9 @josevalim josevalim committed Oct 5, 2012
Showing with 4 additions and 3 deletions.
  1. +2 −2 lib/iex/lib/iex/autocomplete.ex
  2. +2 −1 lib/iex/test/iex/autocomplete_test.exs
View
4 lib/iex/lib/iex/autocomplete.ex
@@ -76,9 +76,9 @@ defmodule IEx.Autocomplete do
expand_module_funs Kernel, atom_to_list(atom)
{:ok, {:__aliases__,_,[root]}} ->
expand_elixir_modules [], atom_to_list(root)
- {:ok, {:__aliases__,_,list}} ->
+ {:ok, {:__aliases__,_,[h|_] = list}} when is_atom(h) ->
hint = atom_to_list(List.last(list))
- list = :lists.sublist(list, length(list)-1)
+ list = Enum.take(list, length(list) - 1)
expand_elixir_modules list, hint
{:ok, {{:., _, [mod,fun]},_,[]}} when is_atom(fun) ->
expand_call mod, atom_to_list(fun)
View
3 lib/iex/test/iex/autocomplete_test.exs
@@ -13,6 +13,7 @@ defmodule IEx.AutocompleteTest do
test :erlang_module_no_completion do
assert expand(':x') == {:no, '', []}
+ assert expand('x.Foo') == {:no, '', []}
end
test :erlang_module_common_prefix_completion do
@@ -69,7 +70,7 @@ defmodule IEx.AutocompleteTest do
assert expand('defreco') == {:yes, 'rd', []}
end
- test :elixir_and_erlang_proxies do
+ test :elixir_proxy do
{:yes, '', list} = expand('E')
assert 'Elixir' in list
end

0 comments on commit 95286df

Please sign in to comment.
Something went wrong with that request. Please try again.