Shopify / Shopify/ruby-lsp-rails
Improve support for `ActiveSupport::Concern`
@andyw8 is already working on this.
Since Dec 17, 2024.
- Dominant language
- Ruby
- Stars
- 688
- Forks
- 44
- PR merge metrics
- No merged PRs in 30d
Description
[!NOTE]
This issue is aimed at those attending the RubyConf 2024 Hack Day
[!CAUTION]
This will likely be a difficult issue, please discuss approaches with the maintainers before attempting.
For ActiveRecord model, you'll notice that you can hover over some DSLs, such as has_one:, to see its documentation, but if you others, such as validates:, nothing is shown.
This is because the ActiveModel::Validations::Callbacks module is mixed into the parent’s class using an included block:
As this a Rails feature, it is not supported by Ruby LSP natively.
It should be possible to support this via an Indexing Enhancement in the Rails addon so that the index knows about ActiveModel::Validations::Callbacks, and Ruby LSP will then be able to show the documentation on hover.
Also, since included can be used in application code, this will improve Ruby's LSP's ability to provide features for your app.
There is partial support for concerns in indexing_enhancement.rb but it doesn't yet know about included.
(Note that there can also be a prepended block).
These articles may help with understanding the details of concerns:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.