Skip to content

Commit

Permalink
simplify docs args
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Jul 20, 2023
1 parent 89905d4 commit 4dea78c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
4 changes: 2 additions & 2 deletions lib/elixir_sense.ex
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ defmodule ElixirSense do
:none ->
nil

%{begin: begin_pos, end: end_pos, context: context} ->
%{begin: begin_pos, end: end_pos} = context ->
{line, col} = begin_pos
metadata = Parser.parse_string(code, true, true, line)

env = Metadata.get_env(metadata, {line, column})

case Docs.all(context, line, col, env, metadata.mods_funs_to_positions, metadata.types) do
case Docs.all(context, line, col, env, metadata) do
{actual_subject, docs} ->
%{
actual_subject: actual_subject,
Expand Down
27 changes: 10 additions & 17 deletions lib/elixir_sense/providers/docs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ defmodule ElixirSense.Providers.Docs do
pos_integer,
pos_integer,
State.Env.t(),
State.mods_funs_to_positions_t(),
State.types_t()
Metadata.t()

Check warning on line 18 in lib/elixir_sense/providers/docs.ex

View workflow job for this annotation

GitHub Actions / static analysis (Elixir 1.15.x | Erlang/OTP 26.x)

unknown_type

Unknown type: Metadata.t/0.
) ::
{actual_mod_fun :: String.t(), docs :: Introspection.docs()} | nil
def all(
Expand All @@ -32,16 +31,15 @@ defmodule ElixirSense.Providers.Docs do
attributes: attributes,
vars: vars
},
mods_funs,
metadata_types
metadata
) do
binding_env = %Binding{
attributes: attributes,
variables: vars,
current_module: module
}

type = SurroundContext.to_binding(context, module)
type = SurroundContext.to_binding(context.context, module)

case type do
nil ->
Expand Down Expand Up @@ -100,8 +98,7 @@ defmodule ElixirSense.Providers.Docs do
requires,
aliases,
module,
mods_funs,
metadata_types,
metadata,
scope
)
end
Expand All @@ -114,8 +111,7 @@ defmodule ElixirSense.Providers.Docs do
requires,
aliases,
module,
mods_funs,
metadata_types,
metadata,
scope
)
end
Expand All @@ -128,8 +124,7 @@ defmodule ElixirSense.Providers.Docs do
requires,
aliases,
module,
mods_funs,
metadata_types,
metadata,
scope
) do
case Binding.expand(binding_env, type) do
Expand All @@ -141,8 +136,7 @@ defmodule ElixirSense.Providers.Docs do
requires,
aliases,
module,
mods_funs,
metadata_types,
metadata,
scope
)

Expand All @@ -158,8 +152,7 @@ defmodule ElixirSense.Providers.Docs do
requires,
aliases,
module,
mods_funs,
metadata_types,
metadata,
scope
) do
actual =
Expand All @@ -171,8 +164,8 @@ defmodule ElixirSense.Providers.Docs do
aliases,
module,
scope,
mods_funs,
metadata_types
metadata.mods_funs_to_positions,
metadata.types
)

case actual do
Expand Down

0 comments on commit 4dea78c

Please sign in to comment.