TextRange (@NotNull final PsiDocTag tag) { final PsiElement[] elements = tag.getDataElements(); if (elements.length == 0) { final PsiElement name = tag.getNameElement(); final int offset = name.getStartOffsetInParent() + name.getTextLength(); return new TextRange(offset, offset); } final PsiElement first = elements[0]; final PsiElement last = elements[elements.length - 1]; return new TextRange(first.getStartOffsetInParent(), last.getStartOffsetInParent()+last.getTextLength()); }