Skip to content

Conversation

@katafrakt
Copy link
Contributor

This fixes a deficiency of a previous implementation of jump-to-definition from HEEx templates (#278). While it worked for some cases, it always looked up a function of arity 2. This happened because arity_at_point function looked up arity of sigil_H function, which is two.

This change introduces partial parsing of the contents of the ~H sigil and adds more precise arity resolving for these cases. This also enables some hover inside ~H (#291).

Additional notes

  • I renamed HeexNormalizer to Heex, because it's not only normalizing anymore. Once the proper support for plugins is added (Macro related Go to definition support and other integrations #270), this module would contain LiveView-specific addons in one place.
  • Curly braces handling is not ideal, but should cover most of the basic cases. TBH I think we can only get so far without using Phoenix.LiveView.TagEngine, but that would create a runtime dependency, which I think is not good without proper extensions support.

@katafrakt katafrakt marked this pull request as draft January 19, 2026 12:28
@katafrakt
Copy link
Contributor Author

There's a Credo failure. here caused by a bug in Credo that has been recently fixed: rrrene/credo#1164

@doorgan
Copy link
Collaborator

doorgan commented Jan 19, 2026

We can update credo to latest

This fixes a deficiency of a previous implementation of
jump-to-definition from HEEx templates. While it worked for some cases,
it always looked up a function of arity 2. This happened because
`arity_at_point` function looked up arity of `sigil_H` function, which
is two.

This change introduces partial parsing of the contents of the ~H sigil
and adds more precise arity resolving for these cases. This also enables
some hover inside ~H.
@katafrakt katafrakt force-pushed the fix-arity-inside-h-sigil branch from efef796 to 606f47f Compare January 19, 2026 13:24
@katafrakt katafrakt force-pushed the fix-arity-inside-h-sigil branch from fe71a0b to cc20e01 Compare January 19, 2026 13:40
@katafrakt katafrakt marked this pull request as ready for review January 19, 2026 13:44
@katafrakt
Copy link
Contributor Author

Updated Credo, now it passes 👍

@mhanberg
Copy link
Member

@katafrakt rebase your changes and then we can merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants