Skip to content

Commit

Permalink
resolve TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Jul 26, 2023
1 parent 3c74d43 commit 8e122bf
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 20 deletions.
8 changes: 3 additions & 5 deletions lib/elixir_sense.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ defmodule ElixirSense do
"""

alias ElixirSense.Core.Applications
alias ElixirSense.Core.Introspection
alias ElixirSense.Core.Metadata
alias ElixirSense.Core.ModuleStore
alias ElixirSense.Core.Parser
Expand Down Expand Up @@ -107,9 +106,9 @@ defmodule ElixirSense do
:none ->
nil

%{begin: {line, _col}} = context ->
context ->
buffer_file_metadata = Parser.parse_string(code, true, true, line)
# TODO line from cursor or begin?

env =
Metadata.get_env(buffer_file_metadata, {line, column})
|> Metadata.add_scope_vars(buffer_file_metadata, {line, column})
Expand Down Expand Up @@ -418,8 +417,7 @@ defmodule ElixirSense do
[]

%{
begin: {begin_line, begin_col},
end: {line, col}
begin: {begin_line, begin_col}
} = context ->
buffer_file_metadata = Parser.parse_string(code, true, true, line)

Expand Down
1 change: 0 additions & 1 deletion lib/elixir_sense/core/introspection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,6 @@ defmodule ElixirSense.Core.Introspection do
[]
end

# TODO return a list here if default args in metadata?
def get_spec_as_string(_module, function, arity, :macro, %{implementing: behaviour}) do
TypeInfo.get_callback(behaviour, :"MACRO-#{function}", arity + 1) |> spec_to_string()
end
Expand Down
13 changes: 0 additions & 13 deletions lib/elixir_sense/core/metadata.ex
Original file line number Diff line number Diff line change
Expand Up @@ -226,19 +226,6 @@ defmodule ElixirSense.Core.Metadata do
end
end

def get_call_arity(%__MODULE__{} = metadata, line, col) do
calls = get_calls(metadata, line)

case Enum.find(calls, fn %State.CallInfo{position: {_line, column}, func: func} ->
column + String.length(Atom.to_string(func)) == col
end) do
%{arity: arity} -> arity
_ -> nil
end
end

# TODO check which version is better

def get_call_arity(%__MODULE__{}, _module, nil, _line, _column), do: nil

def get_call_arity(
Expand Down
2 changes: 1 addition & 1 deletion lib/elixir_sense/providers/implementation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ defmodule ElixirSense.Providers.Implementation do
{{line, column}, type} =
metadata.mods_funs_to_positions
|> Enum.find_value(fn
{{^module, ^maybe_callback, a}, info} when is_nil(maybe_callback) ->
{{^module, ^maybe_callback, _}, info} when is_nil(maybe_callback) ->
{List.last(info.positions), info.type}

{{^module, ^maybe_callback, a}, info} when not is_nil(a) ->
Expand Down

0 comments on commit 8e122bf

Please sign in to comment.