public static @NotNull Pair<LogicalPosition, LogicalPosition> calcCaretLineRange(@NotNull Editor editor) {
    VisualPosition caretPosition = editor.getCaretModel().getCurrentCaret().getVisualPosition();
    return calcSurroundingRange(editor, caretPosition, caretPosition);
  }
public static @NotNull Pair<LogicalPosition, LogicalPosition> calcCaretLineRange(@NotNull Editor editor)