Skip to content

Commit

Permalink
Deprioretize deprecated completions
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Oct 6, 2022
1 parent b941421 commit 036d876
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,15 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
end

defp sort_items(items) do
Enum.sort_by(items, fn %__MODULE__{priority: priority, label: label} ->
Enum.sort_by(items, fn %__MODULE__{priority: priority, label: label} = item ->
# deprioretize deprecated
priority =
if item.tags |> Enum.any?(&(&1 == :deprecated)) do
priority + 30
else
priority
end

{priority, label =~ Regex.recompile!(~r/^[^a-zA-Z0-9]/), label}
end)
end
Expand Down
4 changes: 1 addition & 3 deletions apps/language_server/lib/language_server/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,7 @@ defmodule ElixirLS.LanguageServer.Server do
# close notification send before
JsonRpc.log_message(
:warning,
"Received textDocument/didOpen for file that is already open. Received uri: #{
inspect(uri)
}"
"Received textDocument/didOpen for file that is already open. Received uri: #{inspect(uri)}"
)

state
Expand Down

0 comments on commit 036d876

Please sign in to comment.