elixir-tools / elixir-tools.nvim

Neovim plugin for Elixir
MIT License
403 stars 30 forks source link

Projectionist file create commands don't have a folder for context #81

Closed zolrath closed 1 year ago

zolrath commented 1 year ago

One thing I'm noticing as far as Projectionist features are concerned is that running commands to create files such as :Econtroller post creates the file in /lib/controllers/post_controller.ex instead of the intended /lib/blog_web/controllers/post_controller.ex.

The controller itself also lacks the project name and results in:

defmodule .PostController do
  use , :controller
end

When switching between files with :A the plugin has the proper context to know what folder sits in the glob for /lib/**/controllers/post_controller.ex, but the creation commands don't have any context.

I'm unsure if we're able to provide that context to Projectionist.

mhanberg commented 1 year ago

I think you're supposed to do :Econtroller blog_web/post

zolrath commented 1 year ago

Ah yeah that does work! I suppose that makes sense with the dirname and basename used in the template and the fact Projectionist really wasn't made for Elixir.

Makes me wish it had a pluggable system that we could use to inject the correct name in when in an Elixir project but that's definitely out of scope here!