Skip to content
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

Added support to :float field on model annotations #27

Merged

Conversation

KarlHeitmann
Copy link

I was working on a RoR personal project with some Float fields on many models.

I discovered that solargraph-rails worked fine with every other type of field, but on Floatfields did not.

I did a search on the code using The Silver Searcher tool, and found out that the file lib/solargraph/rails/pin_creator.rb on it's last method called type_translation it was lacking the 'float' => 'Float' pair on the dictionary. That's why the tool was not working.

I've built the gem locally, and tested it with my project and everything went fine. I've also changed the version number from 0.3.0 to 0.3.1 to test it locally, and prevent collisions with my previous installation. I don't know if it is worth to change the version name for such a small change, but I let it anyways.

Also, I've run the tests with rake spec and the 70 tests were green.

I'd like to collaborate with this project. I found it very usefull, and I believe that solargraph typechecking is turning Ruby in some strange "strong typed language", kind of something like Typescript. And there is a lot of dragons to slay, lol. I'd be glad to receive any feedback.

BTW, what does "pin_creator" means? For what I've seen in the code, the class adds the "@return" so the IDE extension can tell what kind of variable will return the method/variable. How can I know more about Solargraph under the hood? Any recommendations or tips? or it is better to dive on the Issues tab on this project?

Best regards,

Karl.

@iftheshoefritz
Copy link
Owner

iftheshoefritz commented Jan 31, 2022

This looks promising, I'll probably do a release on Friday. Thanks for your interest!

PinCreator is about creating Solargraph::Pin::Method objects (the solargraph abstraction for code it searches) after parsing the Rails-specific code. At the end of the process they get piped into Solargraph's brain.

There is some documentation at solargraph.org, but I've spent long hours reading through the source in https://github.com/castwide/solargraph/ which I guess is the only complete reference. You can also look at this talk I did that gives an introduction to solargraph and solargraph-rails.

I love getting PRs here, but there is also a lot of work to do on solargraph itself. In particular, castwide/solargraph#473 relates to how results from this gem disappear after you run solargraph bundle... would love to get that one solved.

@KarlHeitmann
Copy link
Author

Hi Fritz,

Thanks for your feedback. I've seen your conference and now I have an overview about the project, and why it is simple to make plugins, and the importance of Solargraph being a robust software, so that it will be easier to make plugins.

You're right, the better documentation is the code. I will be reading and tinkering on Solargraph code on my spare time, and keep an eye on the issue you mentioned. But I will make no promises, because I still need to pass some hours reading code.

Best,

Karl

Co-authored-by: Esseme <esseme@gmail.com>
@iftheshoefritz iftheshoefritz merged commit 57085bc into iftheshoefritz:main Feb 4, 2022
@iftheshoefritz
Copy link
Owner

Thanks for your help @KarlHeitmann and @Esseme!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants