// 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.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 DaemonListeners.canChangeFileSilently(file) ? new ShowAutoImportPass(file.getProject(), file, editor) : null;
  }
}

@@ -221,16 +221,76 @@
 ting.*;%0A
+import com.intellij.openapi.application.ApplicationManager;%0A
 import c
@@ -1014,16 +1014,72 @@
   return
+ ApplicationManager.getApplication().isUnitTestMode() %7C%7C
  DaemonL
@@ -1114,16 +1114,27 @@
 ly(file)
+%0A          
  ? new S
@@ -1183,16 +1183,27 @@
  editor)
+%0A          
  : null;

allow auto imports in tests by default