Skip to content

Commit 1c9d736

Browse files
v0idpwnjosevalim
authored andcommitted
Fix signature expansion when no docs (#10971)
We were returning an error whenever there wasn't a list of docs. This changes it so it returns an empty list and the expansion can proceed.
1 parent a5caf4b commit 1c9d736

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/iex/lib/iex/autocomplete.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ defmodule IEx.Autocomplete do
128128
with docs when is_list(docs) <- get_docs(module, [:function, :macro], name) do
129129
Enum.map(docs, fn {_, _, signatures, _, _} -> Enum.join(signatures, " ") end)
130130
else
131-
_ -> :error
131+
_ -> []
132132
end
133133
end
134134

lib/iex/test/iex/autocomplete_test.exs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,5 +398,11 @@ defmodule IEx.AutocompleteTest do
398398

399399
assert expand('take(') == {:yes, '', ['take(enumerable, amount)']}
400400
assert expand('derive(') == {:yes, '', ['derive(protocol, module, options \\\\ [])']}
401+
402+
defmodule NoDocs do
403+
def sample(a), do: a
404+
end
405+
406+
assert {:yes, [], [_ | _]} = expand('NoDocs.sample(')
401407
end
402408
end

0 commit comments

Comments
 (0)