fixed incorrect first lambda statement on the line

This commit is contained in:
Egor.Ushakov
2016-02-04 17:24:10 +03:00
parent b019a63949
commit 58cfa7d6e0
@@ -894,9 +894,18 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
if (body == null || !intersects(lineRange, body)) return null;
if (body instanceof PsiCodeBlock) {
for (PsiStatement statement : ((PsiCodeBlock)body).getStatements()) {
if (intersects(lineRange, statement)) {
// return first statement starting on the line
if (lineRange.contains(statement.getTextOffset())) {
return statement;
}
// otherwise check all children
else if (intersects(lineRange, statement)) {
for (PsiElement element : SyntaxTraverser.psiTraverser(statement)) {
if (lineRange.contains(element.getTextOffset())) {
return element;
}
}
}
}
return null;
}