// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.daemon.impl;

import com.intellij.codeHighlighting.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

final class ShowAutoImportPassFactory implements TextEditorHighlightingPassFactory, TextEditorHighlightingPassFactoryRegistrar {
  @Override
  public void registerHighlightingPassFactory(@NotNull TextEditorHighlightingPassRegistrar registrar, @NotNull Project project) {
    registrar.registerTextEditorHighlightingPass(this, new int[]{Pass.UPDATE_ALL,}, null, false, -1);
  }

  @Override
  @Nullable
  public TextEditorHighlightingPass createHighlightingPass(@NotNull PsiFile file, @NotNull final Editor editor) {
    return ApplicationManager.getApplication().isUnitTestMode() || DaemonListeners.canChangeFileSilently(file)
           ? new ShowAutoImportPass(file.getProject(), file, editor)
           : null;
  }
}

@@ -225,68 +225,8 @@
 .*;%0A
-import com.intellij.openapi.application.ApplicationManager;%0A
 impo
@@ -958,64 +958,8 @@
 turn
- ApplicationManager.getApplication().isUnitTestMode() %7C%7C
  Dae
@@ -998,27 +998,16 @@
 ly(file)
-%0A          
  ? new S
@@ -1060,19 +1060,8 @@
 tor)
-%0A          
  : n

remove isUnitTestMode to bring tests behaviour closer to production (IDEA-CR-51560 followup)