Debugger: Fix breakpoints and stepping on a first line (KT-33304)

This commit fixes the 'SmartStepIntoTestGenerated#testFunWithExpressionBody' test.
This commit is contained in:
Yan Zhulanow
2019-08-13 22:10:23 +09:00
parent c3e46ebe5c
commit 39662c09e9
6 changed files with 19 additions and 9 deletions
@@ -319,9 +319,14 @@ public class CodeInsightUtils {
public static PsiElement getTopmostElementAtOffset(@NotNull PsiElement element, int offset) {
do {
PsiElement parent = element.getParent();
if (parent == null || (parent.getTextOffset() < offset) || parent instanceof KtBlockExpression) {
if (parent == null
|| (parent.getTextOffset() < offset)
|| parent instanceof KtBlockExpression
|| parent instanceof PsiFile
) {
break;
}
element = parent;
}
while(true);