Skip to content

Commit 3008da3

Browse files
committed
add workaround for common crash
1 parent 7879b91 commit 3008da3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

apps/elixir_ls_utils/lib/completion_engine.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,8 @@ defmodule ElixirLS.Utils.CompletionEngine do
10221022
end
10231023

10241024
defp get_modules_from_metadata(%State.Env{} = _env, %Metadata{} = metadata) do
1025-
for {{k, nil, nil}, _} <- metadata.mods_funs_to_positions, do: Atom.to_string(k)
1025+
for {{k, nil, nil}, _} when is_atom(k) <- metadata.mods_funs_to_positions,
1026+
do: Atom.to_string(k)
10261027
end
10271028

10281029
defp match_module_funs(
@@ -1122,7 +1123,8 @@ defmodule ElixirLS.Utils.CompletionEngine do
11221123
true ->
11231124
# local macros are available after definition
11241125
# local functions are hoisted
1125-
for {{^mod, f, a}, %State.ModFunInfo{} = info} <- metadata.mods_funs_to_positions,
1126+
for {{^mod, f, a}, %State.ModFunInfo{} = info} when is_atom(f) <-
1127+
metadata.mods_funs_to_positions,
11261128
a != nil,
11271129
(mod == env.module and not include_builtin) or Introspection.is_pub(info.type),
11281130
mod != env.module or State.ModFunInfo.get_category(info) != :macro or

0 commit comments

Comments
 (0)