boolean (@NotNull LookupImpl lookup, @NotNull LookupElement item) { var cancellationChar = lookup.getUserData(CANCELLATION_CHAR); String lookupString = item.getLookupString(); String pattern = lookup.itemPattern(item); if (cancellationChar != null && lookupString.endsWith(cancellationChar.toString())) { return pattern.equals(lookupString.substring(0, lookupString.length() - 1)); } return pattern.equals(lookupString); }