TextRange (@NotNull PsiAnnotation annotation) { PsiElement element = annotation; int startOffset = element.getTextRange().getStartOffset(); PsiElement last = element; while (element instanceof PsiAnnotation) { last = element; element = PsiTreeUtil.skipWhitespacesAndCommentsForward(element); } return new TextRange(startOffset, last.getTextRange().getEndOffset()); }