no duplicates in java var name suggestions

This commit is contained in:
peter
2011-10-26 17:56:51 +02:00
parent 33a19de801
commit 1472a839cb
3 changed files with 23 additions and 0 deletions
@@ -361,11 +361,18 @@ public class JavaMemberNameCompletionContributor extends CompletionContributor {
}
private static void addLookupItems(Set<LookupElement> lookupElements, @Nullable final SuggestedNameInfo callback, PrefixMatcher matcher, String... strings) {
outer:
for (int i = 0; i < strings.length; i++) {
String name = strings[i];
if (!matcher.prefixMatches(name)) {
continue;
}
for (LookupElement lookupElement : lookupElements) {
if (lookupElement.getAllLookupStrings().contains(name)) {
continue outer;
}
}
LookupElement element = PrioritizedLookupElement.withPriority(LookupElementBuilder.create(name).withAutoCompletionPolicy(AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE), -i);
if (callback != null) {