protected static void navigateInEditor(@NotNull OpenFileDescriptor descriptor, @NotNull Editor e) {
    int offset = descriptor.getOffset();
    CaretModel caretModel = e.getCaretModel();
    boolean caretMoved = false;
    if (descriptor.getLine() >= 0) {
      LogicalPosition pos = new LogicalPosition(descriptor.getLine(), Math.max(descriptor.getColumn(), 0));
      if (offset < 0 || offset == e.logicalPositionToOffset(pos)) {
        caretModel.removeSecondaryCarets();
        caretModel.moveToLogicalPosition(pos);
        caretMoved = true;
      }
    }
    if (!caretMoved && offset >= 0) {
      caretModel.removeSecondaryCarets();
      caretModel.moveToOffset(Math.min(offset, e.getDocument().getTextLength()));
      caretMoved = true;
    }

    if (caretMoved) {
      e.getSelectionModel().removeSelection();
      FileEditorManager.getInstance(descriptor.getProject()).runWhenLoaded(e, () -> {
        descriptor.scrollToCaret(e);
        unfoldCurrentLine(e);
      });
    }
  }
protected static void navigateInEditor(@NotNull OpenFileDescriptor descriptor, @NotNull Editor e)