boolean (@Nullable PsiElement element) { if (element == null) return false; PsiElement sibling = element; while (true) { sibling = PsiTreeUtil.nextLeaf(sibling); if (sibling == null) { return true; //eof } final String text = sibling.getText(); if (text.contains("\n")) { return text.charAt(CharArrayUtil.shiftForward(text, 0, " \t")) == '\n'; } if (!(sibling instanceof PsiComment) && !StringUtil.isEmptyOrSpaces(text) && !text.equals(";")) { return false; } } }