diff --git a/lib/livebook/completion.ex b/lib/livebook/completion.ex index 7e4f35783..79d2f5500 100644 --- a/lib/livebook/completion.ex +++ b/lib/livebook/completion.ex @@ -106,6 +106,10 @@ defmodule Livebook.Completion do {:ok, List.to_atom(var)} end + defp expand_dot_path({:module_attribute, _attribute}, _ctx) do + :error + end + defp expand_dot_path({:dot, parent, call}, ctx) do case expand_dot_path(parent, ctx) do {:ok, %{} = map} -> Map.fetch(map, List.to_atom(call)) diff --git a/test/livebook/completion_test.exs b/test/livebook/completion_test.exs index 032a46ecb..4255c588d 100644 --- a/test/livebook/completion_test.exs +++ b/test/livebook/completion_test.exs @@ -925,4 +925,9 @@ defmodule Livebook.CompletionTest do } ] = Completion.get_completion_items("@modu", binding, env) end + + test "handles calls on module attribute" do + {binding, env} = eval(do: nil) + assert [] = Completion.get_completion_items("@attr.value", binding, env) + end end