public static void setVerticalScrollProportion(@NotNull Editor editor, float proportion) {
    ReadAction.run(() -> {
      Rectangle viewArea = editor.getScrollingModel().getVisibleArea();
      LogicalPosition caretPosition = editor.getCaretModel().getLogicalPosition();
      Point caretLocation = editor.logicalPositionToXY(caretPosition);
      int yPos = caretLocation.y;
      yPos -= viewArea.height * proportion;
      editor.getScrollingModel().scrollVertically(yPos);
    });
  }
public static void setVerticalScrollProportion(@NotNull Editor editor, float proportion)