Vlad Faust
Vlad Faust

Reputation: 550

RubyMine code autocompletion

I'm about to get used to work with Java in Android Studio. The great thing there is that everything is strongly declared. So when I type MyClass.someme..., the IDE offers me advanced code autocompletion features. The development is rapid and pleasantly.

But then I wanted to learn RubyOnRails. I'm in love with JetBrains products and so I've installed RubyMine on my Windows machine.

Despite of a bag of problems with Windows enviroment, I was confused with not-so-well working code completion. Even if the method is known by the IDE (it can be found by Ctrl+B combination), it does not offer it in popup menu (discover the picture).

Function from railstutorial.org:

# SomeControllerHelper.rb
# Redirects to stored location (or to the default)
def redirect_back_or (default)
  redirect_to(session[:forwarding_url] || default)
  session.delete(:forwarding_url)
end

Why, RubyMine?

Is there any way to fix this problem? Are there any better IDEs with really smart code completion?

Upvotes: 3

Views: 4493

Answers (2)

rsqLVo
rsqLVo

Reputation: 498

As mentioned before, Ruby's code completion is very complicated due to dynamic typing. Switching from C#/Java I've been struggling with it for some time and I've found one way to at least mitigate it a bit. Example:

def extract_data_from_this_array(input_array)
  # some code
end

Suppose you want to deal with the array you're getting as an input. You type input_array and no methods or all methods are listed, because Ruby has no idea that it's an array. What I do is write:

Array.new.

And RubyMine suggests all Array methods. It helps a lot when you've just picked Ruby.

Upvotes: 8

K M Rakibul Islam
K M Rakibul Islam

Reputation: 34336

Although, RubyMine doesn't work for ALL code completion all the time due to the dynamic nature of Ruby. But, I still find it the BEST Ruby IDE for code completion, method navigation, searching features.

Here is a screenshot to show you how to configure RubyMine for Code Completion:

enter image description here

Here is a good tutorial by Justin Gordon which shows some awesome features of RubyMine which may interest you.

I don't know any other Ruby IDE that has smarter code completion than RubyMine. In fact, a vast majority of Ruby programmers doesn't even use an IDE, rather they use a Text Editor!

Here are couple of short sitepoint articles that would give you more insights:

Which IDEs do Rubyists Use?

What Editor Do Rubyists Use?

Upvotes: 2

Related Questions