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: