From 979c45db629e4f9b2377e5a08fd67fde923fa52a Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Fri, 14 Apr 2017 17:21:16 +0300 Subject: [PATCH] Fix inspection results highlighting for files with custom inspection profiles --- .../codeInsight/daemon/impl/LocalInspectionsPass.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java index dfe27cfa5f79..a1a7f35aab01 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java @@ -49,7 +49,6 @@ import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.Trinity; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.profile.codeInspection.ProjectInspectionProfileManager; import com.intellij.psi.*; import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; @@ -381,7 +380,6 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass private final Map ranges2markersCache = new THashMap<>(); private final TransferToEDTQueue> myTransferToEDTQueue = new TransferToEDTQueue<>("Apply inspection results", new Processor>() { - private final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(myProject).getCurrentProfile(); private final InjectedLanguageManager ilManager = InjectedLanguageManager.getInstance(myProject); private final List infos = new ArrayList<>(2); private final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject); @@ -400,7 +398,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass PsiFile file = psiElement.getContainingFile(); Document thisDocument = documentManager.getDocument(file); - HighlightSeverity severity = inspectionProfile.getErrorLevel(HighlightDisplayKey.find(tool.getShortName()), file).getSeverity(); + HighlightSeverity severity = myProfileWrapper.getErrorLevel(HighlightDisplayKey.find(tool.getShortName()), file).getSeverity(); infos.clear(); createHighlightsForDescriptor(infos, emptyActionRegistered, ilManager, file, thisDocument, tool, severity, descriptor, psiElement); @@ -455,7 +453,6 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass } private void addHighlightsFromResults(@NotNull List outInfos, @NotNull ProgressIndicator indicator) { - InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(myProject).getCurrentProfile(); PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject); InjectedLanguageManager ilManager = InjectedLanguageManager.getInstance(myProject); Set> emptyActionRegistered = new THashSet<>(); @@ -470,7 +467,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass for (InspectionResult inspectionResult : resultList) { indicator.checkCanceled(); LocalInspectionToolWrapper tool = inspectionResult.tool; - HighlightSeverity severity = inspectionProfile.getErrorLevel(HighlightDisplayKey.find(tool.getShortName()), file).getSeverity(); + HighlightSeverity severity = myProfileWrapper.getErrorLevel(HighlightDisplayKey.find(tool.getShortName()), file).getSeverity(); for (ProblemDescriptor descriptor : inspectionResult.foundProblems) { indicator.checkCanceled(); PsiElement element = descriptor.getPsiElement();