Open Trevoke opened 8 years ago
Personally I use projectile to locate files. This works pretty well for all elixir projects that follows a strict file naming structure.
I would recommend people needing this functionality to checkout Projectile, which is available on melpa.
Well -- alchemist already implements this functionality with C-c a n c
for controllers, m
for models, etc.
On Sat, Apr 9, 2016 at 10:44 AM Martin Gausby notifications@github.com wrote:
Personally I use projectile to locate files. This works pretty well for all elixir projects that follows a strict file naming structure.
I would recommend people needing this functionality to checkout Projectile, which is available on melpa.
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/tonini/alchemist.el/issues/220#issuecomment-207798345
I am sorry I didn't read your issue-description well enough; i see that you suggest something that works with projectile—the very project I suggest checking out :) That is what I get for checking and replying to issues on my phone while riding a train.
Well -- alchemist already implements this functionality with
C-c a n c
for controllers,m
for models, etc.
So does that mean that it's already there what you have looking for?
Almost:
Right now I have to type the full file name, e.g. user_controller.ex
. I think it would be nice to be able to just type user
once we are at the controller selection in the minibuffer.
@Trevoke I think that is something you need to add to your own Emacs config. I use ido with fuzzy matching myself and I think that I have what you are asking for. Give flx-ido a try.
Hi Martin,
The same suggestion was accepted and implemented by projectile-rails this way: https://github.com/asok/projectile-rails/issues/2 (there is a link to a commit with cucumber scenarios, which might help explain further what I mean).
It's not something that I need to add to my own emacs config; it is a change to the interface presented by alchemist.
Does this explain better what I am asking for?
On Wed, May 25, 2016 at 8:30 AM Martin Gausby notifications@github.com wrote:
@Trevoke https://github.com/Trevoke I think that is something you need to add to your own Emacs config. I use ido with fuzzy matching myself and I think that I have what you are asking for. Give flx-ido https://github.com/lewang/flx a try.
— You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub https://github.com/tonini/alchemist.el/issues/220#issuecomment-221559918
Okay, I think I got it now:
Say we have the following files in /web/controllers/, _authcontroller.ex, _profilecontroller.ex, and _pagecontroller.ex. Currently the interface for jumping to controllers show: _/web/controllers/authcontroller.ex, _/web/controllers/profilecontroller.ex, etc.
You suggest that they should instead be shown as: auth, profile, page, etc.
I guess this would be possible if we can rely on the filenames to follow the _controller convention; but I don't know if we can trust this assumption; the Phoenix router cares about module names, not file names. A given controller could live in a file somewhere outside of the /web/controllers/ path, and end in something different from _controllers.ex.
The models are even worse because they don't have a _model.ex-postfix.
So, we can't rely on controllers being in the controllers-folder; we can't rely on controllers having the _controller.ex post-fix; the only thing we can rely on is the module name and that sounds like a job for the alchemist-server.
@Trevoke Thanks for reporting this. I think it raises some issues that we need to address.
I'm beginning to pick up on some of the older issues to see if I can help with alchemist. To be clear, this issue is still open because we still want to implement that feature, right?
So, we can't rely on controllers being in the controllers-folder; we can't rely on controllers having the _controller.ex post-fix; the only thing we can rely on is the module name and that sounds like a job for the alchemist-server.
But wouldn't it be possible to implement methods that act like projectile-rails-find-current-<X>
but fall back to the normal quick navigation when no file following the default naming convention can't be found?
For example: I'm in the buffer for /web/models/user.ex
and want to find the corresponding controller. I trigger alchemist-phoenix-find-current-controller
and alchemist looks for /web/controller/user_controller.ex
(or even after that any file with this name in /controller
subfolders or the whole project) and when it can't find the file it falls back to alchemist-phoenix-find-controllers
.
In the case the fallback gets triggered, it would maybe even make sense to prefill user
into the minibuffer of alchemist-phoenix-find-controllers
.
It's possible, but it assumes a naming convention that is not (yet?) established in the Phoenix world.
On Mon, Mar 12, 2018 at 9:50 AM, FAP notifications@github.com wrote:
So, we can't rely on controllers being in the controllers-folder; we can't rely on controllers having the _controller.ex post-fix; the only thing we can rely on is the module name and that sounds like a job for the alchemist-server.
But wouldn't it be possible to implement methods that act like projectile-rails-find-current-
but fall back to the normal quick navigation when no file following the default naming convention can't be found? For example: I'm in the buffer for /web/models/user.ex and want to find the corresponding controller. I trigger alchemist-phoenix-find- current-controller and alchemist looks for /web/controller/user_ controller.ex (or even after that any file with this name in /controller subfolders or the whole project) and when it can't find the file it falls back to alchemist-phoenix-find-controllers. In the case the fallback gets triggered, it would maybe even make sense to prefill user into the minibuffer of alchemist-phoenix-find-controllers.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tonini/alchemist.el/issues/220#issuecomment-372315914, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEJSS6nPIIudJ0Ey8nAzVSzUk5B_ZlTks5tdn0ugaJpZM4IDoAd .
…and considering that the layout of a phoenix project has changed since this thread was started.
I still think the framework specific features of alchemist should get pulled into their own Emacs packages (alchemist-phoenix, alchemist-nerves, etc). Other than that I have no stakes in this.
I think that's reasonable.
On Wed, Mar 14, 2018, 05:49 Martin Gausby notifications@github.com wrote:
…and considering that the layout of a phoenix project has changed since this thread was started.
I still think the framework specific features of alchemist should get pulled into their own Emacs packages (alchemist-phoenix, alchemist-nerves, etc). Other than that I have no stakes in this.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tonini/alchemist.el/issues/220#issuecomment-372962954, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEJSZj9kA9CRGChfT_qTwzf6QlnkTpMks5teOe0gaJpZM4IDoAd .
I made the same suggestion to projectile-rails. I am fairly confident it made sense for projectile-rails, but here I'm newish to Elixir and Phoenix, and I don't know if my suggestion is reasonable, especially when you consider umbrella projects. In any case --
It would be nice if I could type the keyboard shortcut to find a controller file and just have to type / have the main name autocompleted.
That is, for
user_controller.ex
, I'd like to just have to typeuser
. Same for the modeluser.ex
(different context / function / keybinding, so I think it's OK).What do you think?