Thursday, January 11, 2007

Ruby Screenshot of the Week

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.


If you've listened to the latest Java Posse episode (#99, around 56 minutes into the podcast) you heard me getting caught red handed, coding in the background while we were recording. Joe pressed me to state exactly what I was working on: Code completion within Ruby require and load statements in NetBeans. Here's a screenshot:






This will hopefully be available soon...


3 comments:

  1. Tor, this looks really nice. I'm interested in two things:
    First, will that code completion change depending on if you've used require_gem/gem before that place, and if you have a require 'rubygems' or not?
    Secondly, how much of the internals for these things depend on NetBeans libraries being available? I would sort of like having these features for Emacs... =)

    ReplyDelete
  2. Meh. Ruby is so 2006. All the cool kids are getting groovy in 2007. ;)

    ReplyDelete
  3. Hi Ola (sorry about the delay). First, no, code completion is currently not looking at previous require statements to eliminate possibilities. Unlike HTML where it is an error to repeat an attribute twice, Ruby is supposed to track these things and only load things it hasn't seen before - so I didn't think this was a very important feature. Having said that, it's obviously something that's possible and probably not very hard to do. I already want to do some computations on the require-graph to limit the requires you see, since you typically get lots of irb ones or activerecord ones, where you probably should only see the "important" (root) ones that include others.
    Recording the second question: well, there's a lot of infrastructure here, but if you're only talking about the database part, that should be easy to query from other tools. Of course, there's also a lot of logic for keeping the indices in sync as you're editing files (it's not only indexing the libraries and gems, it's indexing your projects as well) so that would probably involve quote a lot of elisp to replicate... Hopefully once this is released I can convince you to use NetBeans instead of Emacs for some of your Ruby editing. At least that's an interesting challenge for me! You tell me what features are missing and I'll see if I can't make you happy!

    ReplyDelete