jemmyw / vscode-rails-fast-nav

vscode extension for navigating Ruby on Rails projects
https://marketplace.visualstudio.com/items?itemName=jemmyw.rails-fast-nav
MIT License
41 stars 12 forks source link

Feature request: Show more related files, like all views or decorators #5

Open chriso0710 opened 5 years ago

chriso0710 commented 5 years ago

Hi Jeremy,

I just tested some of the rails smart file switchers in the VS Code marketplace. I think yours is the best and the fastest. I particularly like the 2 lines per file in the switcher with the type headline.

These are the files for a contract model in my rails app:

./app/admin/contracts.rb
./app/assets/javascripts/contracts.js
./app/controllers/contracts_controller.rb
./app/decorators/contract_decorator.rb
./app/helpers/contracts_helper.rb
./app/models/contract.rb
./app/views/contracts
./app/views/contracts/_contract.html.erb
./app/views/contracts/_filter.html.erb
./app/views/contracts/index.html.erb
./app/views/contracts/show.html.erb
./test/controllers/contracts_controller_test.rb
./test/decorators/contract_decorator_test.rb
./test/models/contract_test.rb

Your extension only shows the test and the controller file in my project. It would be great if it would also show all views and the decorator/presenter. Maybe the additional tests, helper and JS files too.

I would have tried to fix this myself and sent a PR, but I have no TS skill and currently no local dev environment for TS ;-)

Christian

jemmyw commented 5 years ago

Hi Christan, thanks for your suggestion.

Views In the case of showing all views, I've take then view (ha) that this is something you would only want a full listing of from the controller. If you run alt+r or alt+v from the controller file you will see them there.

Fast switching to a view from a model? alt+c alt+v in quick succession and you have the list, and this combined with VSCode not keeping file tabs around unless they've changed is pretty good. Of course I could add alt+v from the model, I'm tempted to do that, but I don't want all the views listed in the alt+r list from the model.

Decorator/presenter This is an interesting idea. It would require a bit of modification. I probably wouldn't want to make it specific to those as they're not standard Rails files, but perhaps making it do a search on app/*/model_name_*.rb would be sensible.

chriso0710 commented 5 years ago

Thanks for your quick response and your opinion on this.

I would like to have the views available from the model with ALT-R or ALT-V. Maybe we could have an individual setting for this...

Yes, decorators are not standard Rails (they should be IMHO). I can not imagine any professional/larger Rails project not using the decorator/presenter pattern. Makes developer life so much better :-) I think it would be a good fit for your extension.

Christian