From bbfffa7865681b4af530f2f0af19e674ec18da82 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 10 Mar 2013 10:47:19 +0100 Subject: [PATCH] allow empty weigher arrays --- .../codeInsight/completion/impl/CompletionSorterImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/impl/CompletionSorterImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/impl/CompletionSorterImpl.java index 6fd844bfd2a4..d1ee57108e74 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/impl/CompletionSorterImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/impl/CompletionSorterImpl.java @@ -47,7 +47,8 @@ public class CompletionSorterImpl extends CompletionSorter { } @Override public CompletionSorterImpl weighBefore(@NotNull final String beforeId, LookupElementWeigher... weighers) { - assert weighers.length > 0 : "there should be weighers"; + if (weighers.length == 0) return this; + CompletionSorterImpl result = this; for (LookupElementWeigher weigher : weighers) { result = result.withClassifier(beforeId, true, weighingFactory(weigher)); @@ -56,7 +57,8 @@ public class CompletionSorterImpl extends CompletionSorter { } @Override public CompletionSorterImpl weighAfter(@NotNull final String afterId, LookupElementWeigher... weighers) { - assert weighers.length > 0 : "there should be weighers"; + if (weighers.length == 0) return this; + CompletionSorterImpl result = this; for (int i = weighers.length - 1; i >= 0; i--) { LookupElementWeigher weigher = weighers[i];