diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/ProblemDescriptorImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/ProblemDescriptorImpl.java index ab434c9165c7..2ae97b01bbbe 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/ProblemDescriptorImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/ProblemDescriptorImpl.java @@ -160,6 +160,13 @@ public class ProblemDescriptorImpl extends CommonProblemDescriptorImpl implement return myEnforcedTextAttributes; } + public TextRange getTextRangeForNavigation() { + TextRange textRange = getTextRange(); + if (textRange == null) return null; + PsiElement element = getPsiElement(); + return InjectedLanguageManager.getInstance(element.getProject()).injectedToHost(element, element.getTextRange()); + } + public TextRange getTextRange() { PsiElement startElement = getStartElement(); PsiElement endElement = myEndSmartPointer == null ? startElement : getEndElement(); diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java index c0008e364fb1..dafc108e254f 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java @@ -645,7 +645,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren if (virtualFile != null) { int startOffset = psiElement.getTextOffset(); if (descriptor instanceof ProblemDescriptorImpl) { - final TextRange textRange = ((ProblemDescriptorImpl)descriptor).getTextRange(); + final TextRange textRange = ((ProblemDescriptorImpl)descriptor).getTextRangeForNavigation(); if (textRange != null) { if (virtualFile instanceof VirtualFileWindow) { virtualFile = ((VirtualFileWindow)virtualFile).getDelegate();