Geertjan's Blog

  • August 28, 2013

Beefed Up Code Completion in NetBeans IDE 7.4

Geertjan Wielenga
Product Manager

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

Join the discussion

Comments ( 6 )
  • markiewb Wednesday, August 28, 2013

    @Geertjan: Thanks for the kudos and thanks also to Dusan Balek (who fixed some issue regarding this new feature). Subword completion is inspired by Intellij IDEA and the "code recommenders" plugin for Eclipse. The regex for the matching was taken from one of the blogs linked within the issue.

  • Chris Nahr Thursday, August 29, 2013

    Excellent news. I found subword completion very helpful in Visual Studio, great to see it coming to NetBeans.

  • O RLY Monday, October 21, 2013

    Welcome to the 21st century, NetBeans.

  • guest Thursday, January 16, 2014

    Unfortunately this version/fix lost the ability to suggest variable names for types which aren't imported and the ability to autoformat javadocs by inserting tabs and stars, both of which were more valuable to me.

  • Geertjan Thursday, January 16, 2014

    Not really sure what you're talking about, guest, would appreciate it if you'd drop me an e-mail at geertjan.wielenga@oracle.com so we can find out what it is you mean, because NetBeans doesn't just 'lose' features, sounds like bugs to me.

  • Daniel Brüggemann Thursday, March 20, 2014

    I really like the subword completion feature. Sometimes I just remember one part of a method but not necessarely the first, so subword completion saves me some time there.

    However, it still has some problems. The biggest one is that it doesn't prefer exactly matching suggestions and just seems to sort the suggestions alphabetically. I put an example for that in this bug entry:


    As in most cases you know the exact method name, this behavior can be again time consuming (as you always have to select out of the list) and makes me turn subword completion off again.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.