TextRange (final @NotNull XmlAttributeValue xmlAttributeValue) { final PsiElement first = xmlAttributeValue.getFirstChild(); if (first == null) { return TextRange.EMPTY_RANGE; } final ASTNode firstNode = first.getNode(); assert firstNode != null; final PsiElement last = xmlAttributeValue.getLastChild(); final ASTNode lastNode = last != null && last != first ? last.getNode() : null; final int textLength = xmlAttributeValue.getTextLength(); final int start = firstNode.getElementType() == XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER ? first.getTextLength() : 0; final int end = lastNode != null && lastNode.getElementType() == XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER ? last.getTextLength() : 0; return new TextRange(start, textLength - end); }