General Ruby Code Completion

First off, I love IDEA for flash development. Absolutely solid. Recently, I've been doing a bunch of ruby stuff on the side in Textmate. I've been wanting to switch to ruby plugin for quite awhile now to get some similarity and features that I get with flash development in IDEA. But whenever I try out the ruby plugin hoping to make the full swich, the code completion holds me back. Maybe I'm just spoiled from how great completion is with AS3. It just seems that there is always something in a ruby file that isnt in the completion index.

For example: (This is a Padrino project, not Rails)
Screen shot 2011-02-22 at 1.24.38 AM.png

You can see that belongs_to is found fine. And so are some other ActiveRecord methods. Yet, validates_presence_of isnt. I see this in at least 100 other places in this small little project. Unless I'm doing something wrong, this just seems incomplete. Especially compared to how flawless AS3 completion is.

Basically, I feel if I can't always expect completion to work in any ruby project, I might as well keep to Textmate.

Please show me what I'm missing here. :)

Thanks.

4 comments
Comment actions Permalink

Hate to bump. I've looked around the forums for similar topics. But havent found my exact case.

http://devnet.jetbrains.net/message/5277864#5277864
Talks about when cc completly doesnt work. Not my issue, since mine works in some cases.

http://devnet.jetbrains.net/message/5286316#5286316
Is kind of similar, but its dealing with a hash key not being completed.

Thanks.

0
Comment actions Permalink

Hi Michael,
Which IDEA and Ruby plugin versions do you use. Is your application Rails 2.x or 3.x?

0
Comment actions Permalink

Hello Roman,

IDEA 10.0.2. Build #IU-103.72.
Ruby Plugin 3.1.17343.

And I mentioned that this wasnt a Rails project but a Padrino one. If thats the reason why. I would be qurious to know the limitations of the ruby plugin's code inspection in a non Rails project.

Thanks!

0
Comment actions Permalink

And I mentioned that this wasnt a Rails project but a Padrino one.

Seems I missed it.

I would be qurious to know the limitations of the ruby plugin's code inspection in a non Rails project.

Rails project differs from ordinary Ruby projects by their implicit class loading and lots of dynamic method declarations, modules inclusions etc. Not all of such meta programming structures can be statically analyzed thus RubyMine code insight engine is optimized for Rails meta programming semantics.

E.g. Controller class doesn't explicitly require models classes but RubyMine knows that on runtime for undefined class name rails gem will look for a ruby file with corresponding name and class in it. If such ruby script and class can be found rails gem will try to load the script implicitly. So RubyMine emulates such behaviour and understands rails models in context of rails controllers.

As for ordinary Ruby - you will get correct autocompletion and resolve only if all "require" calls, methods and class declarations, modules inclusion, etc. are explicit.

0

Please sign in to leave a comment.