Skip to content

Only use shell_docs for html docs (OTP26-) #13583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 21, 2024
Merged
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions lib/iex/lib/iex/introspection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ defmodule IEx.Introspection do
case Code.ensure_loaded(module) do
{:module, _} ->
case Code.fetch_docs(module) do
{:docs_v1, _, :erlang, _, _, _, _} = erl_docs ->
{:docs_v1, _, :erlang, "application/erlang+html", _, _, _} = erl_docs ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a TODO to remove support for "application/erlang+html" once we are on OTP 27+.

:shell_docs.render(module, erl_docs) |> IO.puts()

{:docs_v1, _, _, format, %{} = doc, metadata, _} ->
Expand Down Expand Up @@ -378,7 +378,7 @@ defmodule IEx.Introspection do
spec = get_spec(mod, fun, arity)

cond do
language == :erlang ->
language == :erlang and format == "application/erlang+html" ->
print_erlang_doc(mod, fun, arity, docs_v1)
:ok

Expand Down Expand Up @@ -667,7 +667,7 @@ defmodule IEx.Introspection do
"""
def t(module) when is_atom(module) do
case :code.get_doc(module) do
{:ok, {:docs_v1, _, :erlang, _, _, _, _} = erl_docs} ->
{:ok, {:docs_v1, _, :erlang, "application/erlang+html", _, _, _} = erl_docs} ->
:shell_docs.render_type(module, erl_docs) |> IO.puts()

_ ->
Expand All @@ -690,7 +690,7 @@ defmodule IEx.Introspection do

def t({module, type}) when is_atom(module) and is_atom(type) do
case get_docs(module, [:type]) do
{:erlang, _, _, erl_docs} ->
{:erlang, "application/erlang+html", _, erl_docs} ->
case :shell_docs.render_type(module, type, erl_docs) do
{:error, :type_missing} -> types_not_found_or_private("#{inspect(module)}.#{type}")
iodata -> IO.puts(iodata)
Expand Down Expand Up @@ -724,7 +724,7 @@ defmodule IEx.Introspection do

def t({module, type, arity}) when is_atom(module) and is_atom(type) and is_integer(arity) do
case get_docs(module, [:type]) do
{:erlang, _, _, erl_docs} ->
{:erlang, "application/erlang+html", _, erl_docs} ->
case :shell_docs.render_type(module, type, arity, erl_docs) do
{:error, :type_missing} -> types_not_found_or_private("#{inspect(module)}.#{type}")
chardata -> IO.puts(chardata)
Expand Down
Loading