Skip to content

Erlang Error in Elixir Language Server with Surface #701

@lucas-stellet

Description

@lucas-stellet

Describe the bug

I started a new project from zero using the mix phx.new, and then I ran the mix surface.init --demo --catalogue --layouts to set up Surface.

After I started to follow the Getting Started guide, I realized there is no Surface intellisense when I started to write the slot macro.

I use Visual Studio Code with ElixirLS extension.

Checking the elixir-ls logs I could see the log below:

[Warn  - 16:16:39] ** (ErlangError) Erlang error: "ArgumentError during metadata build pre:\ncould not call Module.register_attribute/3 because the module NoahWeb.Components.ExampleComponent is already compiled\nast node: {:use, [end_of_expression: [newlines: 0, line: 2, column: 24], line: 2, column: 3], [{:__aliases__, [last: [line: 2, column: 15], line: 2, column: 7], [:Surface, :Component]}]}"
    (elixir 1.15.4) lib/module.ex:2310: Module.assert_not_readonly!/2
    (elixir 1.15.4) lib/module.ex:1660: Module.register_attribute/3
    (surface 0.11.0) expanding macro: Surface.BaseComponent.__using__/1
    nofile: NoahWeb.Components.ExampleComponent (module)

How to reproduce it

Create a new project with the last version of Phoenix.
Add the last version of surface.
Use Visual Studio Code with ElixirLS extension. Both in the last version released.

The behavior you expected

Your Environment

Surface: v0.11.0
LiveView: v0.19.5
Elixir: v1.15.4
Erlang: v26.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions