private static @NotNull String getCommentLine(@NotNull Document document,
                                                @NotNull TextRange lineRange,
                                                @NotNull TextRange commentRange,
                                                @NotNull String prefix,
                                                @NotNull String suffix) {
    int startOffset = Math.max(lineRange.getStartOffset(), commentRange.getStartOffset());
    int endOffset = Math.min(lineRange.getEndOffset(), commentRange.getEndOffset());

    String commentPart = document.getText(new TextRange(startOffset, endOffset));

    int suffixIdx = commentPart.indexOf(suffix);
    if (suffixIdx != -1) commentPart = commentPart.substring(0, suffixIdx).trim();

    int prefixIdx = commentPart.indexOf(prefix);
    if (prefixIdx != -1) commentPart = commentPart.substring(prefixIdx + prefix.length());

    return commentPart;
  }
private static @NotNull String getCommentLine(@NotNull Document document,
                                                @NotNull TextRange lineRange,
                                                @NotNull TextRange commentRange,
                                                @NotNull String prefix,
                                                @NotNull String suffix)