Properly positioning compilation exceptions in the IDE

This commit is contained in:
Andrey Breslav
2012-04-25 12:25:00 +04:00
parent 3eb6b3d0f5
commit d0bd5cf9c6
5 changed files with 60 additions and 14 deletions
@@ -80,11 +80,16 @@ public class DiagnosticUtils {
@NotNull
public static LineAndColumn getLineAndColumn(@NotNull Diagnostic diagnostic) {
PsiFile file = diagnostic.getPsiFile();
Document document = file.getViewProvider().getDocument();
List<TextRange> textRanges = diagnostic.getTextRanges();
if (textRanges.isEmpty()) return LineAndColumn.NONE;
TextRange firstRange = textRanges.iterator().next();
return offsetToLineAndColumn(document, firstRange.getStartOffset());
return getLineAndColumnInPsiFile(file, firstRange);
}
@NotNull
public static LineAndColumn getLineAndColumnInPsiFile(PsiFile file, TextRange range) {
Document document = file.getViewProvider().getDocument();
return offsetToLineAndColumn(document, range.getStartOffset());
}
@NotNull