static @Nullable LightweightHint showEditorFragmentHintAt(Editor editor,
                                                  TextRange range,
                                                  int y,
                                                  boolean showUpward,
                                                  boolean showFolding,
                                                  boolean hideByAnyKey,
                                                  boolean useCaretRowBackground) {
    if (ApplicationManager.getApplication().isUnitTestMode()) return null;
    Document document = editor.getDocument();

    int startOffset = range.getStartOffset();
    int startLine = document.getLineNumber(startOffset);
    CharSequence text = document.getCharsSequence();
    // There is a possible case that we have a situation like below:
    //    line 1
    //    line 2 <fragment start>
    //    line 3<fragment end>
    // We don't want to include 'line 2' to the target fragment then.
    boolean incrementLine = false;
    for (int offset = startOffset, max = Math.min(range.getEndOffset(), text.length()); offset < max; offset++) {
      char c = text.charAt(offset);
      incrementLine = StringUtil.isWhiteSpace(c);
      if (!incrementLine || c == '\n') {
        break;
      }
    }
    if (incrementLine) {
      startLine++;
    }

    int endLine = document.getLineNumber(range.getEndOffset()) + 1;

    if (startLine >= endLine) return null;

    EditorFragmentComponent fragmentComponent = createEditorFragmentComponent(editor, startLine, endLine, showFolding, true,
                                                                              useCaretRowBackground);

    if (showUpward) {
      y -= fragmentComponent.getPreferredSize().height;
      y  = Math.max(0,y);
    }

    final JComponent c = editor.getComponent();
    int x = SwingUtilities.convertPoint(c, new Point(JBUIScale.scale(-3), 0), UIUtil.getRootPane(c)).x; //IDEA-68016

    LightweightHint currentHint = SoftReference.dereference(editor.getUserData(CURRENT_HINT));
    if (currentHint != null) currentHint.hide();

    Point p = new Point(x, y);
    LightweightHint hint = new MyComponentHint(fragmentComponent);
    HintManagerImpl.getInstanceImpl().showEditorHint(hint, editor, p, (hideByAnyKey ? HintManager.HIDE_BY_ANY_KEY : 0) |
                                                                      HintManager.HIDE_BY_SCROLLING |
                                                                      HintManager.HIDE_BY_TEXT_CHANGE |
                                                                      HintManager.HIDE_BY_MOUSEOVER,
                                                     0, false, new HintHint(editor, p));
    editor.putUserData(CURRENT_HINT, new WeakReference<>(hint));
    return hint;
  }
static @Nullable LightweightHint showEditorFragmentHintAt(Editor editor,
                                                  TextRange range,
                                                  int y,
                                                  boolean showUpward,
                                                  boolean showFolding,
                                                  boolean hideByAnyKey,
                                                  boolean useCaretRowBackground)