private static Pair<Integer, String> getLineCommentStart(@NotNull Editor editor,
                                                           int offset,
                                                           @NotNull CodeDocumentationAwareCommenter commenter) {
    if (offset < 1) return Pair.pair(-1, null);
    EditorHighlighter highlighter = editor.getHighlighter();
    HighlighterIterator iterator = highlighter.createIterator(offset - 1);
    if (!commenter.getLineCommentTokenTypes().contains(iterator.getTokenType())) return Pair.pair(-1, null);

    int startOffset = iterator.getStart();
    String commentedLineText = editor.getDocument().getText(new TextRange(startOffset, offset));
    String possiblePrefix = ContainerUtil.find(commenter.getLineCommentPrefixes(), commentedLineText::contains);
    String prefix = possiblePrefix != null ? possiblePrefix : commenter.getLineCommentPrefix();
    if (startOffset + (prefix == null ? 0 : prefix.length()) <= offset) {
      return Pair.pair(startOffset, prefix);
    }
    return Pair.pair(-1, null);
  }
private static Pair<Integer, String> getLineCommentStart(@NotNull Editor editor,
                                                           int offset,
                                                           @NotNull CodeDocumentationAwareCommenter commenter)