PsiElement (PsiCodeBlock anchorBlock, @NotNull PsiElement firstElement) { PsiElement element = firstElement; while (element != null && element.getParent() != anchorBlock) { element = element.getParent(); } return element; }