Skip to content

Commit f8f09a7

Browse files
authored
Give better warning for incomplete erlang install (#434)
1 parent 9370e42 commit f8f09a7

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

apps/language_server/lib/language_server/cli.ex

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ defmodule ElixirLS.LanguageServer.CLI do
66
WireProtocol.intercept_output(&JsonRpc.print/1, &JsonRpc.print_err/1)
77
Launch.start_mix()
88

9-
{:ok, _} = Application.ensure_all_started(:language_server, :temporary)
9+
start_language_server()
10+
1011
IO.puts("Started ElixirLS v#{Launch.language_server_version()}")
1112
Launch.print_versions()
1213

@@ -16,4 +17,26 @@ defmodule ElixirLS.LanguageServer.CLI do
1617

1718
WireProtocol.stream_packets(&JsonRpc.receive_packet/1)
1819
end
20+
21+
defp start_language_server do
22+
guide =
23+
"https://github.com/elixir-lsp/elixir-ls/blob/master/guides/incomplete-installation.md"
24+
25+
case Application.ensure_all_started(:language_server, :temporary) do
26+
{:ok, _} ->
27+
:ok
28+
29+
{:error, {:edoc, {'no such file or directory', 'edoc.app'}}} ->
30+
raise "Unable to start ElixirLS due to an incomplete erlang installation. " <>
31+
"See #{guide}#edoc-missing for guidance."
32+
33+
{:error, {:dialyzer, {'no such file or directory', 'dialyzer.app'}}} ->
34+
raise "Unable to start ElixirLS due to an incomplete erlang installation. " <>
35+
"See #{guide}#dialyzer-missing for guidance."
36+
37+
{:error, _} ->
38+
raise "Unable to start ElixirLS due to an incomplete erlang installation. " <>
39+
"See #{guide} for guidance."
40+
end
41+
end
1942
end

guides/incomplete-installation.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Incomplete installations is a frequent cause of ElixirLS failures. Generally
2+
this is resolved by:
3+
* Installing elixir and erlang with ASDF https://github.com/asdf-vm/asdf
4+
(recommended)
5+
* Installing a full version of Erlang via the package manager
6+
7+
## dialyzer missing
8+
9+
On Ubuntu this is caused by the required `erlang-dialyzer` package not being
10+
installed. For Ubuntu this can be fixed by running `sudo apt-get install erlang
11+
erlang-dialyzer` or installing Elixir and Erlang via ASDF
12+
https://github.com/asdf-vm/asdf
13+
14+
Relevant issue: https://github.com/elixir-lsp/vscode-elixir-ls/issues/134
15+
16+
## edoc missing
17+
18+
On fedora this is caused by the required `erlang-edoc `package not being
19+
installed. For fedora this can be fixed by running `sudo dnf install erlang
20+
erlang-edoc` or installing Elixir and Erlang via ASDF
21+
https://github.com/asdf-vm/asdf
22+
23+
Relevant issue: https://github.com/elixir-lsp/elixir-ls/issues/431

0 commit comments

Comments
 (0)