PsiExpression (@NotNull PsiExpression expression) { while(true) { PsiElement parent = expression.getParent(); if (parent instanceof PsiExpression && !(parent instanceof PsiLambdaExpression)) { expression = (PsiExpression)parent; } else if (parent instanceof PsiExpressionList && parent.getParent() instanceof PsiExpression) { expression = (PsiExpression)parent.getParent(); } else { return expression; } } }