boolean (@NotNull PsiElement element) { if (PsiTreeUtil.getParentOfType(element, XmlComment.class) != null && element.getNode().getElementType() != XmlTokenType.XML_COMMENT_START) { return false; } if (PsiTreeUtil.getParentOfType(element, XmlText.class) != null) { return true; } if (element.getNode().getElementType() == XmlTokenType.XML_START_TAG_START) { return true; } PsiElement parent = element.getParent(); if (parent instanceof PsiErrorElement) { parent = parent.getParent(); } return parent instanceof XmlDocument; }