diff --git a/lib/elixir_sense/core/introspection.ex b/lib/elixir_sense/core/introspection.ex index fec15a57..8a0f06ab 100644 --- a/lib/elixir_sense/core/introspection.ex +++ b/lib/elixir_sense/core/introspection.ex @@ -1189,6 +1189,12 @@ defmodule ElixirSense.Core.Introspection do [] end + # erlang docs have signature included in metadata + def get_spec_as_string(_module, _function, _arity, :function, %{signature: signature}) do + [{:attribute, _, :spec, spec}] = signature + spec |> spec_to_string() + end + def get_spec_as_string(_module, function, arity, :macro, %{implementing: behaviour}) do TypeInfo.get_callback(behaviour, :"MACRO-#{function}", arity + 1) |> spec_to_string() end @@ -1291,6 +1297,11 @@ defmodule ElixirSense.Core.Introspection do end) end + def spec_to_string({{_module, name, arity}, specs}) when is_atom(name) and is_integer(arity) do + # spec with module - transform it to moduleless form + spec_to_string({{name, arity}, specs}) + end + @spec actual_module( nil | module, [{module, module}],