PsiElement (@Nullable PsiElement element) { PsiElement current = element; while (current != null) { final PsiElement parent = current.getParent(); if (parent instanceof PsiModifiableCodeBlock || parent instanceof PsiLambdaExpression || parent instanceof PsiStatement) { break; } current = parent; } return current; }