Beefed Up Code Completion in NetBeans IDE 7.4
By Geertjan-Oracle on Aug 28, 2013
When I call up code completion in all versions of NetBeans IDE, the Java Editor gives typed suggestions for completing the current statement:
This is called code completion. No surprises there.
However, if I invoke code completion a second time (i.e., press Ctrl-Space twice), a deeper level of suggestions is returned in NetBeans IDE 7.3.1, as well as in recent releases before that:
However, in NetBeans IDE 7.4, instead of the above, the code completion includes suggestions applicable to attributes from the current scope of variables, in the form of parameters for methods:
This is also known as "chained completion". In other words, when in NetBeans IDE 7.4 you invoke code completion a second time, the Java Editor will scan variables, fields and methods, which are visible from the context, and then suggest a chain that conforms to the relevant type.
More info about this can be found here:
Next, another excellent enhancement, this time by external contributor Benno Markiewicz. In 7.3.1, I try to use code completion here, because I'm interested to see whether any methods relating to property listening can be attached to my object:
No luck, as you can see. In 7.4, however, there's a new checkbox in the Options window, disabled by default because the underlying functionality is potentially slower and you'll get more results so is potentially confusing, so that explicit enablement means you know what you're getting yourself into, named "Subword completion", as you can see below:
And now, I get some very interesting and, more importantly, useful results, applicable to properties on my object:
More info about subword completion can be found here: https://netbeans.org/bugzilla/show_bug.cgi?id=212412