New Code Completion and Suggestions
Are you curious about the newest
NetBeans editor improvements? Two hot topics are redesigned code completion and suggestions. I got a permission from the developers to post steps how to build NetBeans with these - so you can try them out! Checkout and build takes some time and effort, so be prepared for it. You have been warned.
1. Checkout CVS sources - CVSROOT=:pserver:anoncvs@cvs.netbeans.org:/cvs (more info
here):
- cvs checkout -P stable_nowww
- cvs checkout -P -r completion editor/completion java/editor
- cvs checkout -P -f -r completion nbbuild_nowww
The size of downloaded files is around 430 MB. No, we won't help you with paying your Internet connection bill.
2. Build NetBeans with ant using following command in nbbuild subdirectory (more info
here):
- ant build-nozip all-editor/errorstripe all-editor/errorstripe/annotations all-java/errorstripe all-tasklist/errorstripe all-editor/hints all-java/hints
That's it, once the IDE is built, you can czech the new features out. In case you have troubles with building, write me a comment and I'll help you.
Warning: these features are under development and the IDE built with them
should not be used in production environment. Their functionality may change and no quality is guaranteed. There are several known bugs and the UI will be changed, too. Take them just as
preview of new functionality.
New Code Completion:

Improved, faster, sexier.
|
- The new Code Completion is faster. An existing Code Completion result list is simply narrowed down when typing additional characters instead of computing new result lists repeatedly.
- The new Code Completion has modified layout of the result list items. An information being completed is at the beginning of an item's text (i.e. simple name followed by a package name in parentheses is displayed for classes, simple name followed by a type name is displayed for class members). Type names are aligned to the right side of the completion window.
- The new Code Completion introduces a tooltip popup for displaying method parameters. Code Completion for methods changed its behavior. It uses tooltip popup to show method parameters instead of their incremental completion. The tooltip popup with method parameters can be invoked on demand using
Alt-Space.
- The new Code Completion popup size is not limited by the parent text component size.
- The new Code Completion allows users to *press
'.', ';', and ',' next to Enter to complete the text and close the popup.
- The new Code Completion supports anonymous inner classes. Try to invoke code completion after writing
new Runn|, the text new Runnable() { public void run() {} } is completed. Use Ctrl+Enter to complete text without a body skeleton.
- The new Code Completion supports overriding/implementing methods generation. Try to invoke code completion in a class body between members. Items to create skeletons of all methods that can be overridden/implemented are returned.
- The new Code Completion supports getters/setters generation. Try to invoke code completion in a class body between members. Items to create getter and setter method stubs are returned.
- The Code Completion support for Javadoc and keywords is being prepared.
- The new Code Completion makes the Javadoc popup hidden by default. It can be invoked on demand using
Ctrl+Shift+Space.
Suggestions (aka Editor Hints):
A lightbulb for Java editor, which provides several hints. When a light bulb appears, press Alt-Enter to get the list of possible hints. Most hints are available on lines with error annotations.

Better than your paperclip!
|
Currently, there are following hints available:
- Add import
- Implement all abstract methods. Works for both "normal" classes and annonymous inner classes
- Add throws clause to the method header
- Create method/field
- Add cast (for example:
List l; String s = l.get(0);)
- Encapsulate field: works on non-private fields
Why am I posting this? We want to know your feedback. If you take your time to download and build NetBeans from CVS, please spare a minute or two and let us know what you think about the improvements.