Permalink
Browse files

Also autocomplete when / was already typed in

  • Loading branch information...
1 parent fa10442 commit 91b43f244c704a573f2d71056f2da142cdb45a13 @josevalim josevalim committed Oct 25, 2012
Showing with 9 additions and 2 deletions.
  1. +7 −1 lib/iex/lib/iex/autocomplete.ex
  2. +2 −1 lib/iex/test/iex/autocomplete_test.exs
@@ -57,15 +57,21 @@ defmodule IEx.Autocomplete do
expand_dot reduce(t)
h === ?: ->
expand_erlang_modules
- (h in ?a..?z) or (h in ?A..?Z) or h in [?_, ??, ?!] ->
+ identifier?(h) ->
expand_expr reduce(expr)
+ (h == ?/) and t != [] and identifier?(hd(t)) ->
+ expand_expr reduce(t)
h in '(+[' ->
expand ''
true ->
no_match
end
end
+ defp identifier?(h) do
+ (h in ?a..?z) or (h in ?A..?Z) or h in [?_, ??, ?!]
+ end
+
defp expand_dot(expr) do
case Code.string_to_ast expr do
{:ok, atom} when is_atom(atom) ->
@@ -55,7 +55,8 @@ defmodule IEx.AutocompleteTest do
end
test :elixir_function_completion_with_arity do
- assert expand('Enum.all?') == {:yes, '', ['all?/2']}
+ assert expand('Enum.all?') == {:yes, '', ['all?/2']}
+ assert expand('Enum.all?/') == {:yes, '', ['all?/2']}
end
test :elixir_macro_completion do

0 comments on commit 91b43f2

Please sign in to comment.