@NotNull
  private static List<BooleanSupplier> collectAutoImports(@NotNull PsiFile file) {
    if (file instanceof PsiCompiledElement) return List.of();
    Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
    if (document == null) return List.of();
    Editor editor = new ImaginaryEditor(file.getProject(), document);
    List<ReferenceImporter> referenceImporters = ContainerUtil.filter(
      ReferenceImporter.EP_NAME.getExtensionList(),
      importer -> importer.isAddUnambiguousImportsOnTheFlyEnabled(file));
    if (referenceImporters.isEmpty()) {
      return Collections.emptyList();
    }
    List<BooleanSupplier> result = new ArrayList<>();
    file.accept(new PsiRecursiveElementWalkingVisitor() {
      @Override
      public void visitElement(@NotNull PsiElement element) {
        if (!(element instanceof PsiLanguageInjectionHost)) { // ignore contributed references from languages and plugins
          for (PsiReference reference : element.getReferences()) {
            if (reference.resolve() == null) {
              for (ReferenceImporter importer : referenceImporters) {
                BooleanSupplier action = importer.computeAutoImportAtOffset(editor, file, element.getTextRange().getStartOffset(), true);
                if (action != null) {
                  result.add(action);
                }
              }
            }
          }
        }

        super.visitElement(element);
      }
    });

    return result;
  }
@NotNull
  private static List<BooleanSupplier> collectAutoImports(@NotNull PsiFile file)