ruby-lsp
ruby-lsp copied to clipboard
Support Ruby on Rails detection based on Rails individual gems
I have checked that this feature is not already implemented
- [X] This feature does not exist
Use case
Currently, ruby-lsp detects if a project uses Rails and will automatically bundle the ruby-lsp-rails gem.
It would be useful if this detection was not only done for the rails gem, but also on a combination of sub gems commonly used to run Rails.
Description
Having the the ruby-lsp-rails automatically bundled when a subset of gems are use to run Rails would be useful.
Implementation
It is possible to run Rails without requiring the Rails gem directly. Here is one such example in Discourse.
The current detection:
https://github.com/Shopify/ruby-lsp/blob/410d58453a20089c131eed81a0d5485e0a6b65a7/lib/ruby_lsp/setup_bundler.rb#L151-L153
Could also check if a combination of gem is included in the gemfile and in this case also bundle ruby-lsp-rails. I think checking for:
actionpackactivemodelactiverecordactivesupportrailties
Would be enough to ensure that the app is actually running Rails. The other gems included by the Rails gem are not strictly required to run Rails and will sometimes be absent:
actioncableactionmailboxactionmaileractiontextactivejobactivestorage