Search in sources :

Example 1 with CharFilter

use of com.intellij.codeInsight.lookup.CharFilter in project intellij-community by JetBrains.

the class LookupTypedHandler method getFiltersDecision.

@Nullable
private static CharFilter.Result getFiltersDecision(char charTyped, LookupImpl lookup) {
    lookup.checkValid();
    LookupElement item = lookup.getCurrentItem();
    int prefixLength = item == null ? lookup.getAdditionalPrefix().length() : lookup.itemPattern(item).length();
    for (final CharFilter extension : getFilters()) {
        final CharFilter.Result result = extension.acceptChar(charTyped, prefixLength, lookup);
        if (result != null) {
            return result;
        }
        if (lookup.isLookupDisposed()) {
            throw new AssertionError("Lookup disposed after " + extension);
        }
    }
    return null;
}
Also used : CharFilter(com.intellij.codeInsight.lookup.CharFilter) LookupElement(com.intellij.codeInsight.lookup.LookupElement) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

CharFilter (com.intellij.codeInsight.lookup.CharFilter)1 LookupElement (com.intellij.codeInsight.lookup.LookupElement)1 Nullable (org.jetbrains.annotations.Nullable)1