Skip to content

Commit f2fcb18

Browse files
committed
report detected features
1 parent 1045e68 commit f2fcb18

File tree

1 file changed

+15
-3
lines changed
  • apps/language_server/lib/language_server

1 file changed

+15
-3
lines changed

apps/language_server/lib/language_server/cli.ex

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,33 @@ defmodule ElixirLS.LanguageServer.CLI do
108108
end
109109

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

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

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

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

126130
Logger.notice(
127131
"Elixir sources not found (checking in #{dir}). Code navigation to Elixir modules disabled."
128132
)
133+
false
134+
else
135+
true
129136
end
137+
JsonRpc.telemetry("elixir_sources", %{"elixir_ls.elixir_sources" => to_string(elixir_sources_available)}, %{})
130138
end
131139

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

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

143151
Logger.notice(
144152
"OTP sources not found (checking in #{dir}). Code navigation to OTP modules disabled."
145153
)
154+
false
155+
else
156+
true
146157
end
158+
JsonRpc.telemetry("otp_sources", %{"elixir_ls.otp_sources" => to_string(otp_sources_available)}, %{})
147159
end
148160
end

0 commit comments

Comments
 (0)