private static XmlTag createTag( @NotNull XmlTag contextTag, @NotNull XmlElementDescriptor descriptor) { String namespace = getNamespace(descriptor); XmlTag tag = contextTag.createChildTag(descriptor.getName(), namespace, null, false); PsiElement lastChild = tag.getLastChild(); assert lastChild != null; lastChild.delete(); // remove XML_EMPTY_ELEMENT_END return tag; }
public static boolean isXmlTagIncomplete(XmlTag xmlTag) { if (xmlTag != null) { return xmlTag.getLastChild() instanceof PsiErrorElement; // getErrorDescription() == "Tag start is not closed" } return false; // xmlTag.getNextSibling() instanceof PsiErrorElement // xmlTag.getFirstChild().getText() == "<" || // xmlTag.getFirstChild().getNode().getElementType().toString() == "XML_START_TAG_START" // && // xmlTag.getLastChild() instanceof PsiErrorElement || // xmlTag.getText().endsWith("IntellijIdeaRulezzz") // return xmlTag.getText().endsWith("IntellijIdeaRulezzz"); }