-
-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsing of nested classes #506
Comments
Same issue here, would like to know if its a best practice to define the module somewhere before using it in a rails context or that a change to solargraph needs to be created. |
I was able to write a plugin that works around this limitation at https://github.com/alisnic/solar-rails. Test and see if it works. |
Since this isn't core Ruby behavior, I would definitely recommend implementing it in a plugin (or at least making it optional). A couple possibilities:
/cc @iftheshoefritz |
That's what I thought. Thanks! Closing here |
If someone reads this, just use nested class and module definitions, its the default in rubocop, also using a nested module or class before the parent module is declared results in an error in plain ruby. Rails has some magic to overcome this, but that does not make it correct. just enforce this Cop: https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/ClassAndModuleChildren to nested and you are golden. |
this is somehow related to #87
Introduction
In standard Ruby, when you define a class without defining its parent module first, this fails:
However, in Rails that's perfectly fine, for example in nested controllers:
Problem report
When solargraph parses such class definitons, it does not generate intermediary pin entries. This leads to the fact that autocomplete for queries like
Api::
will not lead to anything. I wrote a failing spec:Please provide guidelines on how to better fix this. I have a dirty patch that kind of works, but I think this is better done in a plugin, like
solargraph-rails
. Any thoughts / ideas @castwide?Dirty patch
The text was updated successfully, but these errors were encountered: