List<MatchResult> (@NotNull ChooseByNameViewModel base, @NotNull FindSymbolParameters parameters, @NotNull ProgressIndicator indicator, @Nullable Supplier<String[]> allNamesProducer, String namePattern, boolean preferStartMatches) { String matchingPattern = convertToMatchingPattern(base, namePattern); if (matchingPattern.isEmpty() && !base.canShowListForEmptyPattern()) return Collections.emptyList(); List<MatchResult> result = getSortedNames(base, parameters, indicator, allNamesProducer, matchingPattern, preferStartMatches); if (!namePattern.contains("*")) return result; Set<String> allNames = new HashSet<>(ContainerUtil.map(result, mr -> mr.elementName)); for (int i = 1; i < namePattern.length() - 1; i++) { if (namePattern.charAt(i) == '*') { List<MatchResult> namesForSuffix = getSortedNames(base, parameters, indicator, allNamesProducer, convertToMatchingPattern(base, namePattern.substring(i + 1)), preferStartMatches); for (MatchResult mr : namesForSuffix) { if (allNames.add(mr.elementName)) { result.add(mr); } } } } return result; }