tpope / vim-rails

rails.vim: Ruby on Rails power tools
http://www.vim.org/scripts/script.php?script_id=1567
4.1k stars 383 forks source link

*rails-projection-test* does not serves as a default for "alternate" #593

Closed jiz4oh closed 1 year ago

jiz4oh commented 1 year ago

As described in the document, "test" will be used as a default for "alternate".

image

Generally, it is effective. But it is invalid with :confirm A, e.g.

let g:rails_projections = {
      \  "app/controllers/*_controller_decorator.rb": {
      \    "command":  "controller_decorator",
      \    "affinity": "controller",
      \    "test": "spec/requests/{}_controller_spec.rb",
      \ }
      \}

When I call :confirm A in a file names app/controllers/spree/admin/orders_controller_decorator.rb, it raise the error.

image

But, if I set "alternate" explicitly

let g:rails_projections = {
      \  "app/controllers/*_controller_decorator.rb": {
      \    "command":  "controller_decorator",
      \    "affinity": "controller",
      \    "alternate": "spec/requests/{}_controller_spec.rb",
      \    "test": "spec/requests/{}_controller_spec.rb",
      \ }
      \}
image

It's worked now.

PS: A command works nice when alternate file is present regardless if "alternate" is specified. Only :confirm A is broken

Hi @tpope, is this intentional or a bug?

tpope commented 1 year ago

It's one of the reasons the feature is considered experimental. Very unclear where exactly to draw the line.