Skip to content

Commit 685c2fa

Browse files
committed
Display message and help log if unable to build PLTs
Disable dialyzer and continue Fixes #540
1 parent 32e4c29 commit 685c2fa

File tree

1 file changed

+19
-4
lines changed
  • apps/language_server/lib/language_server/dialyzer

1 file changed

+19
-4
lines changed

apps/language_server/lib/language_server/dialyzer/manifest.ex

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,25 @@ defmodule ElixirLS.LanguageServer.Dialyzer.Manifest do
1212
parent = self()
1313

1414
Task.start_link(fn ->
15-
active_plt = load_elixir_plt()
16-
transfer_plt(active_plt, parent)
17-
18-
Dialyzer.analysis_finished(parent, :noop, active_plt, %{}, %{}, %{}, nil, nil)
15+
watcher = self()
16+
17+
{pid, ref} = spawn_monitor(fn ->
18+
active_plt = load_elixir_plt()
19+
send(watcher, :plt_loaded)
20+
transfer_plt(active_plt, parent)
21+
22+
Dialyzer.analysis_finished(parent, :noop, active_plt, %{}, %{}, %{}, nil, nil)
23+
end)
24+
25+
receive do
26+
:plt_loaded -> :ok
27+
{:DOWN, ^ref, :process, ^pid, reason} ->
28+
JsonRpc.show_message(:error, "Unable to build dialyzer PLT. Most likely there are problems with your OTP and elixir installation.")
29+
Logger.error("Dialyzer PLT build process exited with reason: #{inspect(reason)}")
30+
Logger.warn("Dialyzer support disabled. Most likely there are problems with your elixir and OTP installation. Visit https://github.com/elixir-lsp/elixir-ls/issues/540 for help")
31+
# NOTE We do not call Dialyzer.analysis_finished. LS keeps working and building normally
32+
# only dialyzer is not being triggered after every build
33+
end
1934
end)
2035
end
2136

0 commit comments

Comments
 (0)