Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Jul 27, 2023
1 parent 8645d64 commit 7dbd03a
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions apps/language_server/lib/language_server/providers/completion.ex
Original file line number Diff line number Diff line change
Expand Up @@ -165,28 +165,30 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
|> sort_items()

# add trigger signatures to arity 0 if there are higher arity completions that would trigger
commands = items
|> Enum.filter(& &1.kind in [:function, :class])
|> Enum.group_by(&{&1.kind, &1.label})
|> Map.new(fn {key, values} ->
command = Enum.find_value(values, & &1.command)
{key, command}
end)
commands =
items
|> Enum.filter(&(&1.kind in [:function, :class]))
|> Enum.group_by(&{&1.kind, &1.label})
|> Map.new(fn {key, values} ->
command = Enum.find_value(values, & &1.command)
{key, command}
end)

items = items
|> Enum.map(fn
%{command: nil, kind: kind} = item when kind in [:function, :class] ->
command = commands[{kind, item.label}]
if command do
%{item |
command: command,
insert_text: "#{item.label}($1)$0"
}
else
items =
items
|> Enum.map(fn
%{command: nil, kind: kind} = item when kind in [:function, :class] ->
command = commands[{kind, item.label}]

if command do
%{item | command: command, insert_text: "#{item.label}($1)$0"}
else
item
end

item ->
item
end
item -> item
end)
end)

items_json =
items
Expand Down Expand Up @@ -658,7 +660,7 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do

signature_help_supported? = Keyword.get(options, :signature_help_supported, false)
signature_after_complete? = Keyword.get(options, :signature_after_complete, true)

trigger_signature? = signature_help_supported? && arity > 1

command =
Expand Down

0 comments on commit 7dbd03a

Please sign in to comment.