@Nullable
  static XmlToken findEndTagName(@Nullable PsiErrorElement element) {
    if (element == null) return null;

    ASTNode astNode = element.getNode();
    if (astNode == null) return null;

    ASTNode current = astNode.getLastChildNode();
    ASTNode prev = current;

    while (current != null) {
      IElementType elementType = prev.getElementType();

      if ((elementType == XmlTokenType.XML_NAME || elementType == XmlTokenType.XML_TAG_NAME) &&
          current.getElementType() == XmlTokenType.XML_END_TAG_START) {
        return (XmlToken)prev.getPsi();
      }

      prev = current;
      current = current.getTreePrev();
    }

    return null;
  }
@Nullable
  static XmlToken findEndTagName(@Nullable PsiErrorElement element)