private @NotNull Stream<VcsRef> filterAndSort(@NotNull CompletionResultSet result, @NotNull Stream<VcsRef> stream) {
    Stream<VcsRef> matched = stream.filter(ref -> myRoots.contains(ref.getRoot()) &&
                                                  result.getPrefixMatcher().prefixMatches(ref.getName()));
    return filterRefs(matched);
  }
private @NotNull Stream<VcsRef> filterAndSort(@NotNull CompletionResultSet result, @NotNull Stream<VcsRef> stream)