This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 132693 [details] Shows the current state, only proposes "s" and "string" <code> List<String> projects = new ArrayList<String>(); for (String | : projects) { // | defines the current caret } </code> Code complete at the given caret... ACTUAL: code completion suggests "s" or "string" EXPECTED: code completion suggests "project" (and the old ones "s" or "string") <code> List<String> projects = new ArrayList<String>(); for (String project : projects) { } </code> Please suggest the singular form for the variable name when iterating on a variable which looks like a plural form For example: XXXs-> XXX: projects -> project items -> item strings -> string actions -> action ... XXXies->XXXy: entries -> entry tries -> try IMHO: This addition would make the code completion even more useful and the CC looks more intelligent. You do not have to implement all the grammatically specifics of the English language, IMHO these two cases are sufficient in most cases.
Created attachment 142750 [details] Patch draft @Dusan: Please review the proposed patch. Please note that is only a draft - no code cleanup yet. But it works in my manual tests. Create and use a new code template with includes the newly introduced "iterableElementVarName" for (${TYPE iterableElementType default="Object" editable=false} ${ELEM iterableElementVarName default="elem"} : ${ITER iterable default="col"}) { ${selection}${cursor} } I like to get your feedback. Thank you in advance!
@Dusan: Please review the patch
More general fix created. Should cover also the following cases: for(int i = 0; i < args.length; i++) { String | = args[i]; } ==> arg String | = getProjectName(); ==> projectName Fixed in jet-main. http://hg.netbeans.org/jet-main/rev/e0a2163c3e03
Integrated into 'main-silver', will be available in build *201407170001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/e0a2163c3e03 User: Dusan Balek <dbalek@netbeans.org> Log: Issue #227566: Code completion should propose singular variable names - fixed.