Bug 135647 - Inconsistent ordering in content assist
Summary: Inconsistent ordering in content assist
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2006-04-07 16:11 EDT by Wing Hong Ho CLA
Modified: 2009-08-30 02:05 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wing Hong Ho CLA 2006-04-07 16:11:56 EDT
Using 3.2 M6 -- but was there at least since M5
Content Assist preferences set to default.

Consider the following class:

public class ContentAssist {
	public static void main(String[] args) {
		ContentAssist contentAssist;
		contenta // content assist here
	}
}

When performing content assist after "contenta", the class is listed before the field.  On the other hand, performing content assist after "contentA" (note change in capitalization), the field is listed before the class.  The field is also listed before the class when performing content assist after "content" and then incrementally typing "a".

The desired order is to consistently list the field before the class.
Comment 1 David Audel CLA 2006-04-10 05:15:57 EDT
I cannot reproduce the problem.

But by default proposals are sorted by 'relevance' and in this case the field and the type have the same relevance. This could the cause of what you have seen.

tom - how do you exactly sort proposals with the same relevance ?
Comment 2 Tom Hofmann CLA 2006-04-10 05:43:25 EDT
I assume by 'field' you mean the local variable.

Cannot reproduce either.

-- about sorting:

Proposals are first sorted by relevance; proposals of the same relevance are sorted alphabetically. However, in jdt-ui, we sort local variables into a higher bucket than types, so the variable should always be shown first, as long as your prefix does not precisely match the proposal.

If you have a case-sensitive for the type (e.g. "ContentA"), the type will be listed first.

Comment 3 David Audel CLA 2006-04-19 04:12:32 EDT
I cannot reproduce the problem.

Wing - Could you reproduce the problem with the debug completion trace enabled and add the content of the console in this bug report ?
To enable the trace launch eclipse with the '-consoleLog -debug D:\.options' options and add in the '.options' file the lines below.

# Turn on debug tracing for org.eclipse.jdt.core plugin
org.eclipse.jdt.core/debug=true

# Reports codeassist completion activity : recovered unit, inferred completions
org.eclipse.jdt.core/debug/completion=true
Comment 4 Randy Hudson CLA 2006-04-20 17:33:43 EDT
The problem seems to be the local variable is not getting higher priority. Make sure your reproduce with "insert common prefix" disabled, since that interferes with the proposal.

I could reproduce. What are you seeing that is different than described?
Comment 5 David Audel CLA 2006-04-21 04:14:00 EDT
When i complete 'contenta' The field 'contentAssist' is the first proposal and the type 'ContentAssist' is the second proposal. The result is the same if i type 'contentA'.

The type is on the top of the list only if i sort proposals alphabetically instead of by relevance (Preferences>Java>Editor>ContentAssist>Sorting and Filtering>Sort Proposals). And when the proposal are alphabetically sorted, 'ContentAssist' is the first proposal even if i type 'contentA'.
Comment 6 David Audel CLA 2006-04-28 11:45:19 EDT
Cannot reproduce with I20060428-0010.
Closing as REMIND.
I cannot reproduce without specific steps. Please reopen once you add steps to reproduce the problem.
Comment 7 Randy Hudson CLA 2006-04-28 14:02:43 EDT
Wing Hong, I can no longer reproduce in RC1. It might be fixed, or the defaults for sorting changed somehow.
Comment 8 Denis Roy CLA 2009-08-30 02:05:56 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.