-
Notifications
You must be signed in to change notification settings - Fork 224
Open
Description
Environment
- ElixirLS: 0.30.0
- Elixir: 1.19.5
- Erlang/OTP: 28
- Phoenix LiveView: 1.1.25
- Editor: Zed
Description
ElixirLS reports an ArgumentError diagnostic in .html.heex template files that use <script :type={Phoenix.LiveView.ColocatedHook}> (macro components introduced in LiveView 1.1 via PR #3810).
The error appears at line 1 of the template:
** (ArgumentError) macro components are only supported in modules that `use Phoenix.Component`
(phoenix_live_view 1.1.25) lib/phoenix_live_view/tag_engine.ex:894: Phoenix.LiveView.TagEngine.handle_macro_component/3
(phoenix_live_view 1.1.25) lib/phoenix_live_view/tag_engine.ex:250: Phoenix.LiveView.TagEngine.handle_body/1
(language_server 0.30.0) lib/language_server/parser.ex:499: anonymous fn/3 in ElixirLS.LanguageServer.Parser.parse_file/3
The project compiles cleanly with mix compile --force (no warnings or errors).
Reproduction
- Create a Phoenix LiveView module with
use Phoenix.LiveView(or via a helper likeuse MyAppWeb, :live_view) - In its colocated
.html.heextemplate, add a colocated hook:
<div id="my-element" phx-hook=".MyHook">
<script :type={Phoenix.LiveView.ColocatedHook} name=".MyHook">
export default {
mounted() { console.log("mounted") }
}
</script>
</div>- ElixirLS reports the
ArgumentErroron line 1, even thoughmix compilesucceeds
Expected behavior
No diagnostic error, since the template compiles successfully.
Actual behavior
ElixirLS shows the ArgumentError as a diagnostic in the editor.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels