Tweaking NetBeans’ Code Completion Feature
- By Matt Stephens
- May 15, 2006
Yesterday I mentioned NetBeans’ auto-popup code completion window, which I was forced to disable in order to save my sanity. I guess that after criticizing something, I should try to suggest something better. So here goes...
First off, it’s a shame that the completion window isn’t altogether speedier, or – perhaps more importantly – designed to be less intrusive.
And there’s the problem. The code completion window breaks a pretty major rule of UI design: in order to “do nothing” (i.e. carry on typing), the user should be allowed to simply do nothing. By forcing the user to press ESCape whenever the completion window chooses to pop up, the system is disrupting the user’s work flow, uninvited. The user’s only recourse is to disable the feature altogether, which is a shame.
Modal dialogs of any sort are generally disruptive to the user; even “lightweight” popups like the completion window, which aren’t really real windows as such. Even though it isn’t a real window, it still has the effect of a modal dialog because the user must dismiss it before continuing.
Even when the system works well, it’s a bit annoying, because it pops up its suggestions right in front of the code that you’re focusing on.
A better UI approach would be to use an embedded window beneath the code editor. This window would be constantly working away as the user types, with the current suggested code completion bubbling up to the top as quickly as possible.
Then the user could just press Ctrl-Enter (or whatever) to accept its current suggestion, or Ctrl-Space to move the focus into that window (so as to scroll through the list of suggestions, view the JavaScript, etc).
Or, most importantly perhaps, the user could simply ignore the current suggestion to carry on whatever he’s doing. That would also mean that if the system is taking a long time to search its data dictionary, the user isn’t told to “please wait...” in the meantime, but can just carry on typing. Disruption factor: 0.