What would you like to see?
I'd like to be able to Go-to Definition on function components and expressions within Phoenix LiveView HEEX templates. For example, in the following LiveView, I'd like to be able to goto the definition of foo, Foo.bar, Baz, and class() from within the sigil's contents.
defmodule PageLive do
use Phoenix.LiveView
def render(assigns) do
~H"""
<main>
<.foo>
<Foo.bar>Hello, world!</Foo.bar>
<.live_component module={Baz} id="baz" />
<span class={class()} />
</.foo>
</main>
"""
end
defp foo(assigns), do: ~H".."
defp class, do: "w-full"
end
<Foo.bar> and <.foo> desugar to simple function calls, and HEEX expression interpolation (within {}) is just direct Elixir code that can be parsed with the existing parser.
Why?
When working within a Phoenix LiveView application, you spend as much time working within the render function as outside. Render functions are often composed of many other smaller function components and live components, and it improves navigation drastically when you can jump between them directly, without having to resort to Ctrl+F or jumping to the top of the page first to find the corresponding alias.
Alternatives considered
Navigating via the editor's built-in Find and Project Search work OK, as does */#-style Vim motions (find next/prev occurrence). Jumping to the top of the file and using go-to definition on the alias also works.
What would you like to see?
I'd like to be able to Go-to Definition on function components and expressions within Phoenix LiveView HEEX templates. For example, in the following LiveView, I'd like to be able to goto the definition of
foo,Foo.bar,Baz, andclass()from within the sigil's contents.<Foo.bar>and<.foo>desugar to simple function calls, and HEEX expression interpolation (within{}) is just direct Elixir code that can be parsed with the existing parser.Why?
When working within a Phoenix LiveView application, you spend as much time working within the
renderfunction as outside. Render functions are often composed of many other smaller function components and live components, and it improves navigation drastically when you can jump between them directly, without having to resort to Ctrl+F or jumping to the top of the page first to find the correspondingalias.Alternatives considered
Navigating via the editor's built-in Find and Project Search work OK, as does
*/#-style Vim motions (find next/prev occurrence). Jumping to the top of the file and using go-to definition on thealiasalso works.