Skip to content

Commit

Permalink
report detected features
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Oct 22, 2023
1 parent 1045e68 commit f2fcb18
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions apps/language_server/lib/language_server/cli.ex
Original file line number Diff line number Diff line change
Expand Up @@ -108,25 +108,33 @@ defmodule ElixirLS.LanguageServer.CLI do
end

def check_otp_doc_chunks() do
if match?({:error, _}, Code.fetch_docs(:erlang)) do
supported = if match?({:error, _}, Code.fetch_docs(:erlang)) do
JsonRpc.show_message(:warning, "OTP compiled without EEP48 documentation chunks")

Logger.warning(
"OTP compiled without EEP48 documentation chunks. Language features for erlang modules will run in limited mode. Please reinstall or rebuild OTP with appropriate flags."
)
false
else
true
end
JsonRpc.telemetry("eep48", %{"elixir_ls.eep48" => to_string(supported)}, %{})
end

def check_elixir_sources() do
enum_ex_path = Enum.module_info()[:compile][:source]

unless File.exists?(enum_ex_path, [:raw]) do
elixir_sources_available = unless File.exists?(enum_ex_path, [:raw]) do
dir = Path.join(enum_ex_path, "../../../..") |> Path.expand()

Logger.notice(
"Elixir sources not found (checking in #{dir}). Code navigation to Elixir modules disabled."
)
false
else
true
end
JsonRpc.telemetry("elixir_sources", %{"elixir_ls.elixir_sources" => to_string(elixir_sources_available)}, %{})
end

def check_otp_sources() do
Expand All @@ -137,12 +145,16 @@ defmodule ElixirLS.LanguageServer.CLI do
|> to_string
|> String.replace(~r/(.+)\/ebin\/([^\s]+)\.beam$/, "\\1/src/\\2.erl")

unless File.exists?(erlang_erl_path, [:raw]) do
otp_sources_available = unless File.exists?(erlang_erl_path, [:raw]) do
dir = Path.join(erlang_erl_path, "../../../..") |> Path.expand()

Logger.notice(
"OTP sources not found (checking in #{dir}). Code navigation to OTP modules disabled."
)
false
else
true
end
JsonRpc.telemetry("otp_sources", %{"elixir_ls.otp_sources" => to_string(otp_sources_available)}, %{})
end
end

0 comments on commit f2fcb18

Please sign in to comment.