What's New in NetBeans 6.8?

NetBeans 6.8 is well on its way, so it's a good time to have a look at what's new in the NB Ruby support. While 6.8 is mostly a bugfixing release for NB Ruby, there are still several new features and enhancements. I'll list here some of those, for a more complete list of fixed issues and implemented enhancements check this bugzilla query.


  • Upgraded bundled software: 6.8 bundles JRuby 1.4.0, along with Rails 2.3.4 and activerecord-jdbc-adapter 0.9.2 (and friends).
  • Run/Debug File with arguments. When running/debugging a Ruby file, you will now be prompted for arguments:
  • What's more, it's now possible to run/debug Ruby files that don't belong to a NetBeans project. It's good to remember that you can open files in NB from the command line by using the --open switch, e.g.:
    netbeans --open /path/to/file.rb
  • The new Rails project wizard has an option for generating Rails apps with the --with-dispatchers switch:
  • Support for uninstalling a specific version of a gem


  • Support for the test/unit gem (thanks to ehartmann who provided a patch for this!).
  • RSpec 1.2.9 support


While there are no major new things here, there are quite a few minor improvements that will hopefully be useful in the day-to-day work when navigating around a code base. Here are some that come to mind:
  • Go to declaration for super - clicking 'super' in a method body takes you to the super method, e.g. to Foo#bar in the following
  • Support for navigating to the helper class from
    helper :class_name
  • Navigating to actions from
    :action => "action"
    has been supported for a while, but only in views - now it works in controllers too.
  • Support for navigating to templates from
    :template => "a_template.rhtml"
  • Ctrl-Shift-A (or Cmd-Shift-A) in ActionMailer::Base models now takes you to the corresponding view.
  • Navigation support for fields accessible through attr_accessor (and friends), e.g.:
    (This works for Rails' cattr_accessors too).
  • Support for navigating from ActiveRecord associations (i.e. belongs_to, has_many etc) in model classes. Clicking user in
    belongs_to :user
    takes you to the User class. Similarly, clicking projects in:
    has_many :projects
    opens the Project class. This will work also when the class is explicitly specified, e.g. clicking owners in:
    has_many :owners, :class_name => "User"
    opens the User class.


Again, as for Navigation, improvements in the editing area in 6.8 consist of several minor enhancements (and bug fixes) rather than anything too major. One specific area in editing that has seen a lot of improvements in 6.8 is type inference - the IDE now does a much better job in figuring out return types of methods and types of variables, in particular if you have "extended" method type inference enabled in Options -> Misc -> Ruby:

It is still far from 100% reliable, and especially for Rails apps (that tend to have a lot "magic" - dynamically added methods etc) there are many cases where it doesn't work. Anyway, it is something that I'm hoping to gradually improve in subsequent releases so that at some point we'll have faster and more exact code completion, navigation, code analysis and refactoring capabilities (which all require type inference). As of 6.8 the IDE displays the inferred type in the doc pop-up (if it was successfully inferred):

If you feel like knowing the return types of a method is important and the IDE can't for some reason automatically resolve the type, there are ways to help the IDE. First, there is the :return:=> hint the IDE knows about. So to explicitly specify the return type of a method you can do:

def returns_fixnum
and the IDE will know that the method returns a Fixnum. Adding such "propietary" hints may not be everybody's cup of tea, so as an alternative the IDE can also infer the return types if you use the same convention that is used in the standard libraries for indicating return types, i.e.
#  some_method => MyClass
or its variations. For example, String#downcase! has the following RDoc:
  #     str.downcase!   => str or nil
  # Downcases the contents of str, returning nil if no
  # changes were made.
  def downcase!
From that the IDE knows that the method returns a String or NilClass. There are some rules for mapping types used in RDoc to actual Ruby types, such as: str is mapped String, obj => Object etc. Articles can also be used, e.g.: a_fixnum is mapped to Fixnum, an_int => Integer and so on.

Some other enhancements in editing include:

  • Support for method aliases - they are now shown in code completion and you can also navigate to them:
  • Option for indexing only the gems in vendor/gems. If you have all the gems your application needs in vendor/gems, you may want to check the following option in Tools -> Options -> Misc -> Ruby:

    This way the IDE won't scan any gems your app doesn't really use, so you won't see any irrelevant classes/methods in code completion, and the scanning of the project will also be much faster. This is another contribution from ehartmann - thanks once again!
  • Various code completion improvements, such as context sensitive constants.

The NetBeans software is a fantastic tool.

Keep up the good work.

Posted by Randy Reihbrandt on December 03, 2009 at 10:40 AM CET #

NetBeans Team, your product rocks!!!

Posted by Robert Szymczak on December 06, 2009 at 09:47 AM CET #

Thanks both of you for the nice words!

Posted by Erno Mononen on December 07, 2009 at 01:39 AM CET #

Post a Comment:
Comments are closed for this entry.

emononen's blog


Top Tags
« April 2014