Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elixir 1.14 #716

Merged
merged 5 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/elixir_ls_debugger/lib/debugger/variables.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ defmodule ElixirLS.Debugger.Variables do
def child_type(var) when is_pid(var) do
case :erlang.process_info(var) do
:undefined -> :indexed
results -> :named
_results -> :named
end
end

def child_type(var) when is_port(var) do
case :erlang.port_info(var) do
:undefined -> :indexed
results -> :named
_results -> :named
end
end

Expand Down
13 changes: 7 additions & 6 deletions apps/language_server/lib/language_server/providers/completion.ex
Original file line number Diff line number Diff line change
Expand Up @@ -981,14 +981,15 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
insert_text_format(:snippet)
else
insert_text_format(:plain_text)
end,
end
}

json = if item.preselect do
Map.put(json, "preselect", true)
else
json
end
json =
if item.preselect do
Map.put(json, "preselect", true)
else
json
end

# deprecated as of Language Server Protocol Specification - 3.15
json =
Expand Down
2 changes: 2 additions & 0 deletions apps/language_server/lib/language_server/source_file.ex
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ defmodule ElixirLS.LanguageServer.SourceFile do
path = path_from_uri(uri)

try do
true = Code.ensure_loaded?(Mix.Tasks.Format)

if function_exported?(Mix.Tasks.Format, :formatter_for_file, 1) do
{:ok, Mix.Tasks.Format.formatter_for_file(path)}
else
Expand Down
10 changes: 7 additions & 3 deletions apps/language_server/test/providers/formatting_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,11 @@ defmodule ElixirLS.LanguageServer.Providers.FormattingTest do
end

def assert_formatted(path, project_dir) do
assert match?({:ok, [%{}]}, format(path, project_dir)), "expected '#{path}' to be formatted"
assert match?(
{:ok, [%ElixirLS.LanguageServer.Protocol.TextEdit{} | _]},
format(path, project_dir)
),
"expected '#{path}' to be formatted"
end

def refute_formatted(path, project_dir) do
Expand All @@ -512,12 +516,12 @@ defmodule ElixirLS.LanguageServer.Providers.FormattingTest do
path = maybe_convert_path_separators("#{project_dir}/#{path}")

source_file = %SourceFile{
text: "",
text: " asd = 1",
version: 1,
dirty?: true
}

File.write!(path, "")
File.write!(path, " asd = 1")
Formatting.format(source_file, SourceFile.path_to_uri(path), project_dir)
end
end
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%{
"dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"},
"docsh": {:hex, :docsh, "0.7.2", "f893d5317a0e14269dd7fe79cf95fb6b9ba23513da0480ec6e77c73221cae4f2", [:rebar3], [{:providers, "1.8.1", [hex: :providers, repo: "hexpm", optional: false]}], "hexpm", "4e7db461bb07540d2bc3d366b8513f0197712d0495bb85744f367d3815076134"},
"elixir_sense": {:git, "https://github.com/elixir-lsp/elixir_sense.git", "192f5a18f18f2d86ff5731af143ea628c00c01c7", []},
"elixir_sense": {:git, "https://github.com/elixir-lsp/elixir_sense.git", "08bac2a5a0ad867908d77a7087eac756bf7cce43", []},
"erl2ex": {:git, "https://github.com/dazuma/erl2ex.git", "244c2d9ed5805ef4855a491d8616b8842fef7ca4", []},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"getopt": {:hex, :getopt, "1.0.1", "c73a9fa687b217f2ff79f68a3b637711bb1936e712b521d8ce466b29cbf7808a", [:rebar3], [], "hexpm", "53e1ab83b9ceb65c9672d3e7a35b8092e9bdc9b3ee80721471a161c10c59959c"},
Expand Down