boolean (int offset, boolean includingAfterLineComment) { if (!(myCommenter instanceof CodeDocumentationAwareCommenter commenter) || offset == 0) return false; HighlighterIterator it = myEditor.getHighlighter().createIterator(offset - 1); IElementType tokenType = it.getTokenType(); return (tokenType != null && (it.getEnd() > offset && (tokenType == commenter.getLineCommentTokenType() || tokenType == commenter.getBlockCommentTokenType() || tokenType == commenter.getDocumentationCommentTokenType()) || includingAfterLineComment && it.getEnd() == offset && tokenType == commenter.getLineCommentTokenType() && !(commenter instanceof CommenterWithLineSuffix))); }