diff --git a/apps/language_server/lib/language_server/providers/hover.ex b/apps/language_server/lib/language_server/providers/hover.ex index 53d295aad..1c61e8ab1 100644 --- a/apps/language_server/lib/language_server/providers/hover.ex +++ b/apps/language_server/lib/language_server/providers/hover.ex @@ -131,12 +131,15 @@ defmodule ElixirLS.LanguageServer.Providers.Hover do end defp dep_name(root_mod_name, project_dir) do - s = root_mod_name |> source() - - cond do - third_dep?(s, project_dir) -> third_dep_name(s, project_dir) - builtin?(s) -> builtin_dep_name(s) - true -> "" + if not elixir_mod_exported?(root_mod_name) do + "" + else + s = root_mod_name |> source() + cond do + third_dep?(s, project_dir) -> third_dep_name(s, project_dir) + builtin?(s) -> builtin_dep_name(s) + true -> "" + end end end @@ -149,6 +152,10 @@ defmodule ElixirLS.LanguageServer.Providers.Hover do dep.__info__(:compile) |> Keyword.get(:source) |> List.to_string() end + defp elixir_mod_exported?(mod_name) do + ("Elixir." <> mod_name) |> String.to_atom() |> function_exported?(:__info__, 1) + end + defp third_dep?(source, project_dir) do prefix = project_dir <> "/deps" String.starts_with?(source, prefix)