Now, this would be a red-letter day. I was chasing a weird Ape bug, and I found the problem: atomURI#absolutize was returning a URI not a string (and by the way, why doesn’t URI offer String methods like index and =~!?! But I digress.) Anyhow, I moaned, thinking “Crap, that’s used everywhere, what am I gonna break?” What I needed was “Find Usages”... Hah! I’d recently grabbed a new NetBeans 6 pre-release (the 070810 build of M10) and Tor’s been doing some heavy chest-beating recently. Here goes with the right-click.

NetBeans doing Find Usages in ruby code
· · ·
Find Usages output by NetBeans in ruby code

Cowabunga! Now, maybe it’s the case that TextMate and Eclipse and Idea have been doing this for years (commenters: have they?), but my personal Ruby-dev productivity just got a shot in the arm.

Mind you, it also said this:

Refactoring warning from NetBeans

I can imagine all sorts of metaprogramming voodoo that would probably fool the IDE. But in this particular case, it Just Worked.

I keep running across nice little goodies in this build. For example, I was composing an error message and started to type a #{} construct to include a variable, and suddenly it was all bollixed up. A bit of poking around revealed that as soon as I’d hit #, NetBeans had added the {} and moved my cursor. Which is going to be a win like 90% of the time.

Now, you can visit the Ruby part of Tor Norbye’s blog and there are tons of coolio screenshots. But I think what I need to do is invest some quality time plowing through the NetBeans wiki Ruby Pages. Hey Tor, you are keeping those up to date, right?



Contributions

Comment feed for ongoing:Comments feed

From: PJ (Aug 14 2007, at 15:09)

Yes, Eclipse at least does this. It's got all sorts of neat toys for doing class hierarchy exploration and automatic refactoring by pulling out interfaces and such. Admittedly Ruby may not need such powertools... but they sure make cutting through the boilerplate Java a lot faster!

[link]

From: James Abley (Aug 14 2007, at 16:49)

Tim, Would it be possible to add a link to the APE source at http://www.tbray.org/ape/ ?

Cheers,

James

[link]

From: Tim Bray (Aug 14 2007, at 17:18)

Oops, good idea, James. Done.

[link]

From: Charles Oliver Nutter (Aug 14 2007, at 18:14)

PJ: I think the question was whether other tools/editors for Ruby do this. Last time I tried other Ruby IDEs and editors, none did. Of course there's several Java IDEs and editors that do it, but providing the same features for Ruby is a very recent development.

[link]

From: Walter Underwood (Aug 14 2007, at 18:22)

Not especially new. I was using this feature in the late 80's in the Ivo environment from HP Labs.

Ivo doesn't seem to exist on the web, but it was an X Window System (v10) framework with an Emacs (Gnuvo) that shared a message window between editing windows (like the Lisp machines), a GUI debugger, and a static analysis tool that could chase down where C functions were called. Oh, and a game, Ivofish.

The static analysis tool was built on top of cscope from AT&T:

http://www1.bell-labs.com/project/wwexptools/cscope/

cscope is command-line and predates Ivo, but if you want an early GUI "find callers" function, that is Ivoscope (I htink that was the name).

Ivo really should have been released as open source. It was on the very early part of the curve -- GNU Emacs and X Windows were the only really big systems out there, and X Windows was licensed. Still, Ivo was vastly easier to program to than X, with a programmer's guide of just over a hundred pages.

What would be different if Ivo had been the model for Motif?

[link]

From: Ryan Lowe (Aug 15 2007, at 08:55)

A unit test suite is a great way to find breakages or effects from method name/parameter changes in dynamic languages like Ruby, even the metaprogramming usages.

...and you're going to run the test suite before you commit the code to SVN anyway, right? Right.

Make the change in the method and watch the tests fail. Then change the usages those test methods point to. If nothing fails I either a) don't use that method any more or b) I need to write a new test.

[link]

From: evan (Aug 15 2007, at 12:34)

I have some find/grep combos that do this from the command line...

Still, it would be handy to have it integrated.

[link]

From: Forrest Chang (Aug 16 2007, at 00:40)

Hi Tim:

I want to echo Ryan's comment on tests. Without knowing the details, I'm figuring you're now returning a String instead of a URI, that good coverage would handle that pretty well.

I seem to recall when discussing ideas for emacs support for Ruby at RubyConf 06 that you had interest in better built in unit test support, which would suggest to me that you're doing a fair amount in your own work, which had me somewhat surprised at your initial reaction. I could be wrong. rcov and heckle are very much your friend in these cases.

That being said find usages and the refactoring support it would provide are indeed cool.

Forrest

[link]

From: sjs (Aug 16 2007, at 09:46)

> Now, maybe it’s the case that TextMate and Eclipse and Idea have been doing this for years (commenters: have they?)

Right now NetBeans offers a unique Ruby IDE. Nothing else groks Ruby code that well to my knowledge, not even Ruby in Steel (which is only for Visual Studio, so doesn't really even count for me, ymmv).

[link]

author · Dad · software · colophon · rights

August 14, 2007
· Technology (85 fragments)
· · Java (123 more)
· · Ruby (93 more)

By

I am an employee of Amazon.com, but the opinions expressed here are my own, and no other party necessarily agrees with them.

A full disclosure of my professional interests is on the author page.