diff --git a/org.eclim.core/java/org/eclim/plugin/core/command/complete/AbstractCodeCompleteCommand.java b/org.eclim.core/java/org/eclim/plugin/core/command/complete/AbstractCodeCompleteCommand.java index 1f5328cba..66adbdd51 100644 --- a/org.eclim.core/java/org/eclim/plugin/core/command/complete/AbstractCodeCompleteCommand.java +++ b/org.eclim.core/java/org/eclim/plugin/core/command/complete/AbstractCodeCompleteCommand.java @@ -66,7 +66,7 @@ public Object execute(final CommandLine commandLine) if(COMPACT.equals(layout) && results.size() > 0){ results = compact(results); } - Collections.sort(results); + return getResponse(results); } diff --git a/org.eclim.jdt/java/org/eclim/plugin/jdt/command/complete/CodeCompleteCommand.java b/org.eclim.jdt/java/org/eclim/plugin/jdt/command/complete/CodeCompleteCommand.java index d8e64c6f5..310ff0387 100644 --- a/org.eclim.jdt/java/org/eclim/plugin/jdt/command/complete/CodeCompleteCommand.java +++ b/org.eclim.jdt/java/org/eclim/plugin/jdt/command/complete/CodeCompleteCommand.java @@ -167,7 +167,6 @@ protected CodeCompleteResult createCompletionResult( break; case CompletionProposal.FIELD_REF: case CompletionProposal.LOCAL_VARIABLE_REF: - type = CodeCompleteResult.VARIABLE; type = CodeCompleteResult.VARIABLE; break; case CompletionProposal.METHOD_REF: @@ -185,6 +184,9 @@ protected CodeCompleteResult createCompletionResult( // of whether the user ever views it. /*return new CodeCompleteResult( kind, completion, menu, proposal.getAdditionalProposalInfo());*/ - return new CodeCompleteResult(completion, menu, menu, type, offset); + CodeCompleteResult result = new CodeCompleteResult(completion, menu, menu, type, offset); + result.setRelevance(proposal.getRelevance()); + + return result; } } diff --git a/org.eclim.jdt/java/org/eclim/plugin/jdt/command/complete/CompletionComparator.java b/org.eclim.jdt/java/org/eclim/plugin/jdt/command/complete/CompletionComparator.java index 13e3459a6..13f329518 100644 --- a/org.eclim.jdt/java/org/eclim/plugin/jdt/command/complete/CompletionComparator.java +++ b/org.eclim.jdt/java/org/eclim/plugin/jdt/command/complete/CompletionComparator.java @@ -55,6 +55,10 @@ public int compare(CodeCompleteResult o1, CodeCompleteResult o2) return -1; } + if (o1.getRelevance() != o2.getRelevance()) { + return o2.getRelevance() - o1.getRelevance(); + } + return Collator.getInstance(Locale.US).compare( new String(o1.getCompletion()), new String(o2.getCompletion())); } diff --git a/org.eclim.jdt/java/org/eclim/plugin/jdt/command/complete/CompletionProposalCollector.java b/org.eclim.jdt/java/org/eclim/plugin/jdt/command/complete/CompletionProposalCollector.java index 466d1c12b..d2767bc28 100644 --- a/org.eclim.jdt/java/org/eclim/plugin/jdt/command/complete/CompletionProposalCollector.java +++ b/org.eclim.jdt/java/org/eclim/plugin/jdt/command/complete/CompletionProposalCollector.java @@ -91,7 +91,6 @@ public void accept(CompletionProposal proposal) case CompletionProposal.LOCAL_VARIABLE_REF: case CompletionProposal.VARIABLE_DECLARATION: case CompletionProposal.ANNOTATION_ATTRIBUTE_REF: - case CompletionProposal.POTENTIAL_METHOD_DECLARATION: proposals.add(proposal); super.accept(proposal); break;