|
24 | 24 | import com.goide.quickfix.GoRenameQuickFix; |
25 | 25 | import com.intellij.codeInspection.*; |
26 | 26 | import com.intellij.find.FindManager; |
| 27 | +import com.intellij.openapi.application.ApplicationManager; |
27 | 28 | import com.intellij.openapi.command.WriteCommandAction; |
28 | 29 | import com.intellij.openapi.project.Project; |
29 | 30 | import com.intellij.psi.PsiElement; |
@@ -104,18 +105,14 @@ protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsH |
104 | 105 | } |
105 | 106 | } |
106 | 107 |
|
107 | | - if (!problemsHolder.isOnTheFly()) { |
108 | | - resolveAllReferences(file); |
109 | | - } |
| 108 | + if (!problemsHolder.isOnTheFly() || ApplicationManager.getApplication().isUnitTestMode()) resolveAllReferences(file); |
110 | 109 | MultiMap<String, GoImportSpec> unusedImportsMap = GoImportOptimizer.filterUnusedImports(file, importMap); |
111 | 110 | Set<GoImportSpec> unusedImportSpecs = ContainerUtil.newHashSet(unusedImportsMap.values()); |
112 | 111 | for (PsiElement importEntry : unusedImportSpecs) { |
113 | 112 | GoImportSpec spec = GoImportOptimizer.getImportSpec(importEntry); |
114 | | - if (spec != null) { |
115 | | - if (spec.getImportString().resolve() != null) { |
116 | | - problemsHolder.registerProblem(spec, "Unused import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX, |
117 | | - IMPORT_FOR_SIDE_EFFECTS_QUICK_FIX); |
118 | | - } |
| 113 | + if (spec != null && spec.getImportString().resolve() != null) { |
| 114 | + problemsHolder.registerProblem(spec, "Unused import", ProblemHighlightType.GENERIC_ERROR, OPTIMIZE_QUICK_FIX, |
| 115 | + IMPORT_FOR_SIDE_EFFECTS_QUICK_FIX); |
119 | 116 | } |
120 | 117 | } |
121 | 118 | } |
|
0 commit comments