Skip to content

Commit

Permalink
Order by display name instead of toString()
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Dec 5, 2016
1 parent fa232f7 commit 8abd6b1
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ protected ICompletionProposal[] createProposalsAtOffset(ICompilationUnit unit, i

protected ICompletionProposal[] orderByRelevance(ICompletionProposal[] proposals) {
Arrays.sort(proposals, 0, proposals.length, new Comparator<ICompletionProposal>() {
public int compare(ICompletionProposal left, ICompletionProposal right) {
int initial = ((IJavaCompletionProposal) right).getRelevance() - ((IJavaCompletionProposal) left).getRelevance();
if (initial != 0) {
return initial;
} else {
// sort lexically
return left.toString().compareTo(right.toString());
public int compare(ICompletionProposal lhs, ICompletionProposal rhs) {
int leftRel = ((IJavaCompletionProposal) lhs).getRelevance();
int rghtRel = ((IJavaCompletionProposal) rhs).getRelevance();
if (leftRel != rghtRel) {
return rghtRel - leftRel;
}
// sort lexically
return lhs.getDisplayString().compareTo(rhs.getDisplayString());
}
});
return proposals;
Expand Down

0 comments on commit 8abd6b1

Please sign in to comment.