Tuesday April 10, 2007 Code completion now inserts the parameters for the method you select. They are inserted as a live code template such that you can jump from one parameter to the next using Tab or Return. More importantly, the parameters are also displayed as a tooltip over the method call. You can invoke this whenever you're typing in code - not just using code completion. Hit Alt-P (or on the Mac, Ctrl-P) and if the IDE can figure out the method signature of the method call surrounding the caret, it will display the parameter list, and show the current parameter in bold. As you move the caret around, the tooltip will be updated to show which parameter you're currently editing.
Messing with the user's editing workflow is always risky, so please let me know how you feel the new code completion behavior works. The parameter tooltip depends on being able to figure out the signature of the surrounding method call, which depends on type inference, so it may not always work - but it will also improve as I tweak and improve type analysis across code completion, goto declaration, etc.
Also, there is also a Go To Test action now for jumping quickly between a test class and its unit test. Should work in Rails, RSpec, ZenTest, and also between any classes named Foo, FooTest or TestFoo regardless of which files they're in. This action is in the editor context menu, and is bound to Ctrl-Shift-E. To get this stuff, get at least version 0.65 of the Ruby Feature module (see these installation instructions).
P.S. You can find some more information on the Ruby support in an interview I did with Geertjan Wielenga a couple of weeks ago. There are some other interviews in the same series talking about the new language support in NetBeans. The Rails support in NetBeans will soon have improved support for JavaScript, YAML, and RHTML - stay tuned!
(2007-04-10 23:59:52.0) Permalink Comments [26]
Posted by Romain Guy on April 11, 2007 at 12:11 AM PDT #
Yes, the Java editor also has this functionality!
Posted by Tor Norbye on April 11, 2007 at 12:27 AM PDT #
Posted by Romain Guy on April 11, 2007 at 01:53 AM PDT #
Posted by Scott Walter on April 11, 2007 at 06:14 AM PDT #
Posted by Casper on April 11, 2007 at 07:30 AM PDT #
Posted by Ralph on April 11, 2007 at 01:57 PM PDT #
Posted by Ralph on April 11, 2007 at 01:59 PM PDT #
Posted by Ralph on April 11, 2007 at 02:31 PM PDT #
the Mac keybindings recently got broken; up until Milestone 7 this worked. I've been involed in some e-mails on the subject; I'll make sure there's a high priority bug filed on this.
Yes, you need to use Ctrl-Space to invoke code completion. I used to have it auto-activated on "." but got some complaints that it was getting in the way. (It -does- auto activate on ::, e.g. Test::Unit:: will show TestCase and friends).
Hi Scott, we do have an alias named dev@scripting.netbeans.org dedicated to this but there isn't a lot of traffic yet; it's mostly being done through the issue tracker - and a lot of the feedback is coming in through the blog right now :)
Posted by Tor Norbye on April 11, 2007 at 02:38 PM PDT #
Posted by Tor Norbye on April 11, 2007 at 02:51 PM PDT #
Posted by Ralph on April 12, 2007 at 08:15 AM PDT #
Big problem with Ruby, when you define a class, you don't specify the types of its arguments. I concede that is SO powerful but, in many cases, we would probably be better served by giving the IDE a hint of the class we are passing, using some kind of annotations.
The Sapphire Steel guys, which are doing what I believe is a very nice work to get good Intellisense, let you use optional comments in a special format before the declaration and have the ide parse them to infer the types of arguments and return value.
They refer this as "Type assertions" and this is a sample:
Example:
#:return:=>Array
#:arg:names=>Array
#:arg:aName=>String
def addName( names, aName )
return names << aName
end
So, when you later type addName(, the autocomplete shows this tooltip:
addName( names:Array, aName:String):Array
I don't want to start a religion war on typed vs. typeless languages. Truth is I may be wrong but, coming from a Java background, I miss so much a good autocomplete capability in the IDE.
The keyword here is OPTIONAL; since you don't have to do it if you don't like it, it would be only for the rest of us who would really appreciate this feature.
However, if in the end you decide to implement this feature, I think it would be nice to follow the syntax of Sapphire, so the code can be more easily transferred and we avoid creating Ruby dialects. Or, a "Save as Sapphire Comments" or similar can be also a good option.
Anyway, thanks for your great work.
Jose Femenias, (big fan of Java Posse)
P.S.: Sample was taken from this page http://www.sapphiresteel.com/onlinehelp/Type%20Assertions.html
Posted by Jose Femenias on April 12, 2007 at 11:12 AM PDT #
Hi Jose, as of the latest version type assertions are supported. I have looked into this before (and it's part of my JavaOne talk on Ruby tooling), and type assertions are definitely controversial - especially if it's used by code completion to tell you the expected type of methods (since that seems to restrict Ruby's duck typing). On the other hand, it can help your productivity in your own methods if you annotate them with these in that code completion can be more direct. So that's the part I have implemented - type assertions will help the type inference engine when you're using code completion inside that method. They are not propagated to clients elsewhere (yet - something to discuss).
To get these features you need the very latest builds - deadlock build #913 or later (but the Ruby build is not running now; it's waiting for the upstream trunk build to build successfully - so give it a little while.)
Posted by Tor Norbye on April 13, 2007 at 11:56 AM PDT #
Posted by Steven Herod on April 14, 2007 at 04:45 AM PDT #
Ruby1-985 complained today about not meeting the requirements for language support. Looks like it's relying on the next nightly build of Netbeans IDE (ver. 17-04-06 was mentioned in the error).
So, instead of building Netbeans myself, I'm trying out the RubyIDE build. Are there any outstanding issues related to running on Mac? You mentioned there were some problems a while back wiuth keybindings, packaging etc.
Posted by Si on April 17, 2007 at 01:08 AM PDT #
Don't worry about previous question. Since I'm in a different timezone (Italy), I've plenty of time to find out how the IDE build fares. The Wiki info is up to date on current IDE build issues I think.
Do you want rhtml bug reports yet, or would it be better to wait?
Posted by Si on April 17, 2007 at 02:40 AM PDT #
thanks a lot for the support for type assertions and the very quick answer. I understand the subject could be controversial because it seems restricting; that's why I insisted on the optional nature of the implementation. Hopefully, this will satisfy most of us...(But, you know, "You can SATISFY some of the people all of the time, and all of the people some of the time, but you can not SATISFY all of the people all of the time"; hope Mr. Lincoln forgives me for the paraphrasing ) I'm willing to test the feature ASAP.
Thanks AGAIN!
Posted by Jose Femenias on April 17, 2007 at 09:35 AM PDT #
Posted by Ralph on April 17, 2007 at 10:48 AM PDT #
Hi Si, it's still a bit early for RHTML bug reports - a bunch of new stuff landed yesterday (code completion in the HTML part, a navigator) but unfortunately it's affected regular Ruby editing a bit. We'll get this ironed out in the next couple of days. Again, Milestone 9 should be a good build to use and report bugs on.
Jose, yep - we can't satisfy everybody :) But hopefully this is a good start.
Posted by Tor Norbye on April 17, 2007 at 05:49 PM PDT #
Is there a work-in-progress cheatsheet floating around for functions and features currenting being developed/WIP? I'd sure like to see things like how to actually USE the abbreviations that you've just added as well as standard other functions that we're not familiar with. NB is very new for most rubists and we need a little hand holding to get started, especially for whiz-bang features that really will sell us on it.
Posted by Ralph on April 18, 2007 at 08:13 PM PDT #
Also, when typing, for example: "assert_redirected_to :action => 'index'" it does not start autocompleting "asser"... as it seems that it should just by virtue of inspecting Rails. Seems that the autocomplete is not fully baked yet or am I missing something?
Posted by Ralph on April 18, 2007 at 08:18 PM PDT #
Posted by Ralph on April 18, 2007 at 08:21 PM PDT #
Posted by Sergey Kuznetsov on April 19, 2007 at 08:47 AM PDT #
Posted by ylon on April 19, 2007 at 04:16 PM PDT #
Regarding CSS auto completion - the CSS and JavaScript support is being revamped right now - as is RHTML and embedding of these other languages, but I'm not sure exactly how far along it is yet.
Sergey, yep - I got your e-mail - it got buried in my inbox (33,286 messages right now and counting) but I just fired off a reply (and filed an enhancement request on your behalf in Issuezilla.)
Ylon - yes, I have a dark theme I'm using - inspired by the BlueTheme for TextMate. It works okay for Ruby - but I haven't at all tweaked it for other files, such as RHTML. If you want to try it, e-mail me - and maybe we can work together to polish it such that we can spread it more widely.
Posted by Tor Norbye's Weblog on April 25, 2007 at 11:46 AM PDT #
By the way, here's what it looks like: http://blogs.sun.com/tor/resource/bluetheme1.png.
Note however that the rest of the IDE - including code completion popups and such - uses the look and feel of the application, which at least in my case stays white and Mac-like. The one area which is problematic is editor highlights like breakpoints, which don't seem to be configurable by theme - and the breakpoint colors don't work well with a dark theme. I'm going to ping somebody to see what can be done about this.
Posted by Tor Norbye's Weblog on April 25, 2007 at 11:55 AM PDT #