@Override
  public @NotNull TextRange getRangeInElement(final @NotNull XmlTag tag) {
    if (tag.getSubTags().length > 0) {
      // Text range in tag with subtags is not supported, return empty range, consider making this function nullable.
      return TextRange.EMPTY_RANGE;
    }

    final XmlTagValue value = tag.getValue();
    final XmlText[] texts = value.getTextElements();
    return switch (texts.length) {
      case 0 -> value.getTextRange().shiftRight(-tag.getTextOffset());
      case 1 -> getValueRange(texts[0]);
      default -> TextRange.EMPTY_RANGE;
    };
  }
@Override
  public @NotNull TextRange getRangeInElement(final @NotNull XmlTag tag)