private void registerReferenceFixes(@NotNull HighlightInfo info, @NotNull Editor editor, @NotNull PsiFile file, @NotNull PsiReference reference,
                                      @NotNull ProperTextRange visibleRange) {
    ApplicationManager.getApplication().assertIsNonDispatchThread();
    ApplicationManager.getApplication().assertReadAccessAllowed();
    PsiElement referenceElement = reference.getElement();
    if (myProject.isDisposed() || !file.isValid() || editor.isDisposed()
        || DumbService.getInstance(myProject).isDumb() || !referenceElement.isValid()) {
      // this will be restarted anyway on smart mode switch
      return;
    }
    AtomicBoolean changed = new AtomicBoolean();
    try {
      UnresolvedReferenceQuickFixProvider.registerReferenceFixes(
        reference, new QuickFixActionRegistrarImpl(info) {
          @Override
          void doRegister(@NotNull IntentionAction action,
                          @Nls(capitalization = Nls.Capitalization.Sentence) @Nullable String displayName,
                          @Nullable TextRange fixRange,
                          @Nullable HighlightDisplayKey key) {
            super.doRegister(action, displayName, fixRange, key);
            changed.set(true);
          }
        });
      info.setUnresolvedReferenceQuickFixesComputed();
    }
    finally {
      referenceElement.putUserData(JOB, null);
    }
    if (!changed.get() || ApplicationManager.getApplication().isHeadlessEnvironment()) {
      return;
    }
    TextEditorHighlightingPass showAutoImportPass = new ShowAutoImportPass(file, editor, visibleRange);
    // have to restart ShowAutoImportPass manually because the highlighting session might very well be over by now
    ApplicationManager.getApplication().invokeLater(() -> {
      DaemonProgressIndicator sessionIndicator = new DaemonProgressIndicator();
      ProgressManager.getInstance().executeProcessUnderProgress(() -> showAutoImportPass.doApplyInformationToEditor(), sessionIndicator);
    }, __ -> editor.isDisposed() || file.getProject().isDisposed());
  }
private void registerReferenceFixes(@NotNull HighlightInfo info, @NotNull Editor editor, @NotNull PsiFile file, @NotNull PsiReference reference,
                                      @NotNull ProperTextRange visibleRange)