Skip to content

Commit 30cb58e

Browse files
committed
Handle sigils in IEx help
1 parent bf639d2 commit 30cb58e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/iex/lib/iex/introspection.ex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ defmodule IEx.Introspection do
3535
{mod, fun, []} ->
3636
{mod, fun}
3737

38+
{maybe_sigil, [_, _]} ->
39+
case Atom.to_string(maybe_sigil) do
40+
"sigil_" <> _ ->
41+
{:{}, [], [find_decompose_fun_arity(maybe_sigil, 2, context), maybe_sigil, 2]}
42+
43+
_ ->
44+
call
45+
end
46+
3847
{fun, []} ->
3948
{find_decompose_fun(fun, context), fun}
4049

lib/iex/test/iex/helpers_test.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,10 @@ defmodule IEx.HelpersTest do
382382
assert capture_io(fn -> h(def) end) =~ def_h
383383
end
384384

385+
test "prints sigil documentation" do
386+
assert capture_io(fn -> h(~w//) end) =~ "Handles the sigil `~w` for list of words"
387+
end
388+
385389
test "prints __info__ documentation" do
386390
h_output_module = capture_io(fn -> h(Module.__info__()) end)
387391
assert capture_io(fn -> h(Module.UnlikelyTo.Exist.__info__()) end) == h_output_module

0 commit comments

Comments
 (0)