Project: JDT
Bug 107496 [content assist] Automatic Imports Enhancement
Reported: 2005-08-19 22:02:20 | Status: verified fixed

Is it possible to import a class as you type instead of using "Add Import" or "Organise Imports" ? Both the later options are useful and good but disrupt the flow of your typing. As you know, when the "type" is not found, code completions are not available on the "type". So you have to stop and do an "Add Import" or an "Organise Imports" and then continue typing. My suggestion is this; just like code completion (which pops up automatically) "add import" should popup if the parser recognizes a non-unique class or interface; user will then select what he/she wants and continue. If the class or interface is unique import it quietly so that users can continue typing with code-completion. Ofcourse this does mean that when you type "StringBuilder", "String" will also be quietly imported. But such imports will be cleared later via a user invoked "Organise Imports". For non-unique types a pop-up delay can help minimize user anoyance (i.e reasonably fast typers will never face irrelevant pop-ups). Ofcourse some users will completely reject this idea (as bad or due to performance issues) - hence a preference control to enable/disable this feature. I can't imagine there being any performance issues as currently "Add Import" or "Organise Imports" are pretty fast. What do you guys think. Cheers

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/LazyJavaCompletionProposal.java