Fix inspection results highlighting for files with custom inspection profiles

This commit is contained in:
Konstantin Kolosovsky
2017-04-25 16:19:56 +03:00
parent 561f24db64
commit 979c45db62
@@ -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<TextRange, RangeMarker> ranges2markersCache = new THashMap<>();
private final TransferToEDTQueue<Trinity<ProblemDescriptor, LocalInspectionToolWrapper,ProgressIndicator>> myTransferToEDTQueue
= new TransferToEDTQueue<>("Apply inspection results", new Processor<Trinity<ProblemDescriptor, LocalInspectionToolWrapper, ProgressIndicator>>() {
private final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(myProject).getCurrentProfile();
private final InjectedLanguageManager ilManager = InjectedLanguageManager.getInstance(myProject);
private final List<HighlightInfo> 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<HighlightInfo> outInfos, @NotNull ProgressIndicator indicator) {
InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(myProject).getCurrentProfile();
PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject);
InjectedLanguageManager ilManager = InjectedLanguageManager.getInstance(myProject);
Set<Pair<TextRange, String>> 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();