You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 DSLss, 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:
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 DSLss, such as
has_one:
, to see its documentation, but if you others, such asvalidates:
, nothing is shown.This is because the
ActiveModel::Validations::Callbacks
module is mixed into the parent’s class using anincluded
block:https://github.com/rails/rails/blob/d4fff28caf25546dfef68087047af34927a3d5f0/activerecord/lib/active_record/callbacks.rb#L413
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:
The text was updated successfully, but these errors were encountered: