Bug 476004 - [content assist] Completion should first suggest classes whose source is in project
Summary: [content assist] Completion should first suggest classes whose source is in p...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.5   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-27 03:48 EDT by Mickael Istria CLA
Modified: 2015-08-28 04:43 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 Mickael Istria CLA 2015-08-27 03:48:50 EDT
As I'm using JDT for a PDE project, I was willing to use a "project-local" Messages class. When trying to autocomplete "Messages" to also get import added, my project-local class was in the middle of many other Messages classes coming from dependencies/classpath.
In such case, JDT would rather put the project-local class first, since in most cases, it's the one user are willing to use.
Comment 1 Markus Keller CLA 2015-08-27 12:21:12 EDT
Currently, Content Assist maintains a history and shows the most recently used type with a matching name on top. The others are sorted alphabetically by package name.

We should consider adding a "closeness" criterion similar to the Open Resources dialog, see FilteredResourcesSelectionDialog#pathDistance(IContainer). For types, the closeness would be calculated based on package name segments.
Comment 2 Mickael Istria CLA 2015-08-28 04:43:22 EDT
(In reply to Markus Keller from comment #1)
> Currently, Content Assist maintains a history and shows the most recently
> used type with a matching name on top. The others are sorted alphabetically
> by package name.

Most used type at project level or at workspace level? IMO, only project level makes sense. The behaviour In my use-case, I don't believe the one that was shown first is more used in this project than the "local" one.

If it's a project-scoped history, then the result I got seem to show that in my usage scenario, both were tie (and probably never completed uet). In that case, the "tie" ones could be sorted by closeness.