TextRange (final @NotNull PsiElement container) { XmlTag xmlTag = (XmlTag)container; int endOffset = xmlTag.getTextRange().getStartOffset(); for (PsiElement child = xmlTag.getFirstChild(); child != null; child = child.getNextSibling()) { endOffset = child.getTextRange().getEndOffset(); if (child instanceof XmlToken token) { IElementType tokenType = token.getTokenType(); if (tokenType == XmlTokenType.XML_EMPTY_ELEMENT_END || tokenType == XmlTokenType.XML_TAG_END) break; } } return new TextRange(xmlTag.getTextRange().getStartOffset(), endOffset); }