mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-04 03:54:24 +08:00
Fix completion crash on module attribute call (#451)
This commit is contained in:
parent
badbd847dd
commit
aa95d81729
2 changed files with 9 additions and 0 deletions
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue