TextRange (int offset) { CodeDocumentationAwareCommenter commenter = (CodeDocumentationAwareCommenter)myCommenter; HighlighterIterator it = myEditor.getHighlighter().createIterator(offset); if (it.getTokenType() == commenter.getBlockCommentTokenType()) { return new TextRange(it.getStart(), it.getEnd()); } if (docCommentIsBlockComment(commenter)) { PsiComment comment = getCommentAtOffset(offset); if (comment != null && commenter.isDocumentationComment(comment)) { return comment.getTextRange(); } } return null; }