Skip to content

Commit

Permalink
Display message and help log if unable to build PLTs
Browse files Browse the repository at this point in the history
Disable dialyzer and continue
Fixes #540
  • Loading branch information
lukaszsamson committed Oct 31, 2022
1 parent 32e4c29 commit 685c2fa
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions apps/language_server/lib/language_server/dialyzer/manifest.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,25 @@ defmodule ElixirLS.LanguageServer.Dialyzer.Manifest do
parent = self()

Task.start_link(fn ->
active_plt = load_elixir_plt()
transfer_plt(active_plt, parent)

Dialyzer.analysis_finished(parent, :noop, active_plt, %{}, %{}, %{}, nil, nil)
watcher = self()

{pid, ref} = spawn_monitor(fn ->
active_plt = load_elixir_plt()
send(watcher, :plt_loaded)
transfer_plt(active_plt, parent)

Dialyzer.analysis_finished(parent, :noop, active_plt, %{}, %{}, %{}, nil, nil)
end)

receive do
:plt_loaded -> :ok
{:DOWN, ^ref, :process, ^pid, reason} ->
JsonRpc.show_message(:error, "Unable to build dialyzer PLT. Most likely there are problems with your OTP and elixir installation.")
Logger.error("Dialyzer PLT build process exited with reason: #{inspect(reason)}")
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")
# NOTE We do not call Dialyzer.analysis_finished. LS keeps working and building normally
# only dialyzer is not being triggered after every build
end
end)
end

Expand Down

0 comments on commit 685c2fa

Please sign in to comment.