elixir-tools / elixir-tools.nvim

Neovim plugin for Elixir
MIT License
417 stars 31 forks source link

Add liveview folder locations to Projectionist #50

Closed zolrath closed 1 year ago

zolrath commented 1 year ago

Hello!

This adds the live folder to projectionist, though with Phoenix 1.7 lurking around the corner some other additions are likely useful with the modified directory structure.

zolrath commented 1 year ago

Rebased and added the HTML/Component projections shown by German Velasco here: https://twitter.com/germsvel/status/1610283195018141696 Also changed LiveView tests to not add async: true as the default generators don't.

zolrath commented 1 year ago

I have a general question, I think the general naming convention for live views is something like lib/my_app_web/live/foo_live/show.ex and MyAppWeb.FooLive.Show.

If that is true, are you able to make the projection match that pattern? That was the problem I had myself when i tried to add this in my own dotfiles.

Most projects I've seen (LiveBeats as an example) tend to put their LiveViews in the root live/ directory following the naming convention in this project.

https://github.com/fly-apps/live_beats/tree/master/lib/live_beats_web/live

It would be nice to support the folder containing the views components as seen in that repo, but I don't see a clear way to do that in projectionist at the moment.

mhanberg commented 1 year ago

Most projects I've seen (LiveBeats as an example) tend to put their LiveViews in the root live/ directory following the naming convention in this project

Interesting, the phx.gen.live mix task generates files that follow the lib/phoenix_web/live/user_live/show.ex pattern https://github.com/phoenixframework/phoenix/blob/a310102eb0e20b918624bb2323a6afb124fcaddd/test/mix/tasks/phx.gen.live_test.exs#L387

Probably alright tho, if people seem to disagree i assume they'll open an issue.

mhanberg commented 1 year ago

@zolrath thanks for getting this updated!

I'm going to pull it down and make sure it all works (on my machine), but other than my one comment it looks 💯 .

mhanberg commented 1 year ago

Rebased and added the HTML/Component projections shown by German Velasco here: https://twitter.com/germsvel/status/1610283195018141696 Also changed LiveView tests to not add async: true as the default generators don't.

Oh I didn't see this comment before I left mine about the Component projection. I think I still disagree, even with German's testimony.

mhanberg commented 1 year ago

I pulled it down and fixed several bugs, but it's good to go now.

Thank you so much!