boolean (@NotNull PsiElement element) { final PsiElement parent = element.getParent(); if (parent == null) { return false; } for (PsiElement child = parent.getFirstChild(); child != null; child = child.getNextSibling()) { if (child instanceof PsiWhiteSpace) { continue; } if (child != element) { return false; } } return true; }