private static boolean calcCheapEnoughToSearchInFile(@NotNull PsiNamedElement element, PsiFile file) {
    String name = element.getName();
    if (name == null) return false;
    StringSearcher searcher = new StringSearcher(name, true, true);
    CharSequence contents = file.getViewProvider().getContents();
    int[] count = new int[1];
    return searcher.processOccurrences(contents, __->++count[0] <= MAX_OCCURRENCES);
  }
private static boolean calcCheapEnoughToSearchInFile(@NotNull PsiNamedElement element, PsiFile file)