Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/iex/lib/iex/autocomplete.ex
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ defmodule IEx.Autocomplete do
end)

entries =
for key when key != :__struct__ <- Map.keys(pairs),
for key when is_atom(key) and key != :__struct__ <- Map.keys(pairs),
name = Atom.to_string(key),
if(hint == "",
do: not String.starts_with?(name, "_"),
Expand Down
5 changes: 5 additions & 0 deletions lib/iex/test/iex/autocomplete_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,11 @@ defmodule IEx.AutocompleteTest do
assert {:no, [], []} = expand(~c"%{unknown | some: \"foo\", unkno")
end

test "completion for mixed type map keys in update syntax" do
eval("map = %{\"another\" => \"qwe\", some: 1, other: :ok}")
assert {:yes, ~c"me: ", []} = expand(~c"%{map | so")
end

test "completion for struct var keys" do
eval("struct = %IEx.AutocompleteTest.MyStruct{}")
assert expand(~c"struct.my") == {:yes, ~c"_val", []}
Expand Down
Loading