Skip to content

Commit b39509a

Browse files
authored
Elixir 1.11 support (#360)
* silence warning * silence warning * handle eex compiler returning error colum * update elixir_sense * fix warning the test was incomplete * capture log * fix mixfile purging in in_fixture
1 parent 3a94455 commit b39509a

File tree

6 files changed

+30
-8
lines changed

6 files changed

+30
-8
lines changed

apps/elixir_ls_debugger/test/debugger_test.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ defmodule ElixirLS.Debugger.ServerTest do
192192
assert Process.alive?(server)
193193
end
194194

195+
@tag :capture_log
195196
test "Evaluate expression with ERROR result", %{server: server} do
196197
Server.receive_packet(
197198
server,

apps/elixir_ls_utils/mix.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ defmodule ElixirLS.Utils.Mixfile do
1515
start_permanent: false,
1616
build_per_environment: false,
1717
consolidate_protocols: false,
18-
deps: deps()
18+
deps: deps(),
19+
xref: [exclude: [JasonVendored, Logger]]
1920
]
2021
end
2122

apps/elixir_ls_utils/test/support/mix_test.case.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,10 @@ defmodule ElixirLS.Utils.MixTest.Case do
8080
:code.set_path(get_path)
8181

8282
for {mod, file} <- :code.all_loaded() -- previous,
83-
file == :in_memory or (is_list(file) and :lists.prefix(flag, file)) do
84-
purge([mod])
83+
file == :in_memory or file == [] or (is_list(file) and :lists.prefix(flag, file)) do
84+
mod
8585
end
86+
|> purge
8687

8788
restore_project_stack!(project_stack)
8889
end

apps/language_server/lib/language_server/diagnostics.ex

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ defmodule ElixirLS.LanguageServer.Diagnostics do
9393
end
9494

9595
defp split_file_and_description(message, root_path) do
96-
with [_, file, line, description] <- Regex.run(~r/^(.*?):(\d+): (.*)/s, message),
96+
with {file, line, _column, description} <- get_message_parts(message),
9797
{:ok, path} <- file_path(file, root_path) do
9898
{path, String.to_integer(line), description}
9999
else
@@ -102,6 +102,15 @@ defmodule ElixirLS.LanguageServer.Diagnostics do
102102
end
103103
end
104104

105+
defp get_message_parts(message) do
106+
# since elixir 1.11 eex compiler returns line and column on error
107+
case Regex.run(~r/^(.*?):(\d+)(:(\d+))?: (.*)/s, message) do
108+
[_, file, line, description] -> {file, line, 0, description}
109+
[_, file, line, _, column, description] -> {file, line, column, description}
110+
_ -> nil
111+
end
112+
end
113+
105114
defp file_path(file, root_path) do
106115
path = Path.join([root_path, file])
107116

apps/language_server/test/providers/document_symbols_test.exs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,8 +2426,18 @@ defmodule ElixirLS.LanguageServer.Providers.DocumentSymbolsTest do
24262426
end
24272427
"""
24282428

2429-
assert {:ok, document_symbols} = DocumentSymbols.symbols(uri, text, true)
2430-
# IO.inspect(document_symbols, label: "document_symbols")
2431-
# assert String.contains?(message, "Compilation error")
2429+
assert {:ok,
2430+
[
2431+
%Protocol.DocumentSymbol{
2432+
children: [
2433+
%Protocol.DocumentSymbol{
2434+
name: "def hello"
2435+
},
2436+
%Protocol.DocumentSymbol{
2437+
name: "defp greetings"
2438+
}
2439+
]
2440+
}
2441+
]} = DocumentSymbols.symbols(uri, text, true)
24322442
end
24332443
end

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%{
22
"dialyxir": {:hex, :dialyxir, "1.0.0", "6a1fa629f7881a9f5aaf3a78f094b2a51a0357c843871b8bc98824e7342d00a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "aeb06588145fac14ca08d8061a142d52753dbc2cf7f0d00fc1013f53f8654654"},
33
"docsh": {:hex, :docsh, "0.7.2", "f893d5317a0e14269dd7fe79cf95fb6b9ba23513da0480ec6e77c73221cae4f2", [:rebar3], [{:providers, "1.8.1", [hex: :providers, repo: "hexpm", optional: false]}], "hexpm", "4e7db461bb07540d2bc3d366b8513f0197712d0495bb85744f367d3815076134"},
4-
"elixir_sense": {:git, "https://github.com/elixir-lsp/elixir_sense.git", "8c82bc726f6f0e33680287ead72390fe4a8a74dd", []},
4+
"elixir_sense": {:git, "https://github.com/elixir-lsp/elixir_sense.git", "5a37db1bcc4b6d1cbc3dbbc669902af85b5d29ec", []},
55
"erl2ex": {:git, "https://github.com/dazuma/erl2ex.git", "244c2d9ed5805ef4855a491d8616b8842fef7ca4", []},
66
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
77
"forms": {:hex, :forms, "0.0.1", "45f3b10b6f859f95f2c2c1a1de244d63855296d55ed8e93eb0dd116b3e86c4a6", [:rebar3], [], "hexpm", "530f63ed8ed5a171f744fc75bd69cb2e36496899d19dbef48101b4636b795868"},

0 commit comments

Comments
 (0)