-
Notifications
You must be signed in to change notification settings - Fork 30
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
Return type issues #1
Comments
Types are coming back now, but something is going wrong with some types. If I call |
Fixed a bug where additional info in the annotation such as |
Still having a problem with BigDecimal. It seems like Solargraph just doesn't know about BigDecimal and its methods. Created an issue here: castwide/solargraph#393 |
This a more accurate represenation of what ActiveRecord actually does at runtime, and therefore gives better code suggestions when dealing with associations and model classes. I've settled on this as being the best compromise after trying a few different approaches. There are two "challenges" that I believe can't be met any other way (at this time). 1. It is not possible to write a return type annotation for the methods of various ActiveRecord mixins that will be correct for both a model class (e.g. Person.where) and relation (e.g. people.where). [0], [1] 2. It is not possible to represent ActiveRecords "class methods are also relation methods" behaviour without model-specific relation types. It's conceivable that Solargraph could change it's interpretation of [self] on class methods to solve challenge iftheshoefritz#1, but the second challenge really forces our hand. In order to represent this correctly, Solargraph would need support for method-missing delegation, **and** delegating those missing methods to an associated/generic type. Given @castwide is working on RBS support and the Ruby ecosystem is likely to move that way in the future, it seems pragmatic to eat the cost repetition / manual labour in this gem rather than try to push YARD types into supporting that degree of type-level programming. 😅 [0]: castwide/solargraph#592 [1]: lsegal/yard#1257
Solargraph isn't understanding what we send for column return value:
The text was updated successfully, but these errors were encountered: