private void doShowHint(@NotNull QuickEvaluateHandler handler,
                          @NotNull Editor editor,
                          @NotNull Point point,
                          @Nullable EditorMouseEvent event,
                          @NotNull ValueHintType type) {
    cancelAll();
    if (editor.isDisposed() || !handler.canShowHint(myProject)) {
      return;
    }
    if (myCurrentHint != null && myCurrentHint.isInsideHint(editor, point)) {
      return;
    }
    if (event != null && !event.isOverText()) { // do not trigger if there's no text below
      return;
    }

    try {
      QuickEvaluateHandler.CancellableHint cancellableHint = handler.createValueHintAsync(myProject, editor, point, type);
      HintRequest hintRequest = new HintRequest(cancellableHint, type);
      myHintRequest = hintRequest;
      cancellableHint.hintPromise().onProcessed(hint -> {
        if (myHintRequest == hintRequest) { // clear request if it has not changed
          myHintRequest = null;
        }
        if (hint == null) {
          UIUtil.invokeLaterIfNeeded(() -> {
            hideHint();
            if (event != null) {
              EditorMouseHoverPopupManager.getInstance().showInfoTooltip(event);
            }
          });
          return;
        }
        if (myCurrentHint != null && myCurrentHint.equals(hint)) {
          return;
        }
        if (event != null) {
          hint.setEditorMouseEvent(event);
        }
        UIUtil.invokeLaterIfNeeded(() -> {
          if (!hint.canShowHint()) {
            return;
          }

          hideHint();

          myCurrentHint = hint;
          myCurrentHint.invokeHint(() -> {
            if (myCurrentHint == hint) {
              myCurrentHint = null;
            }
          });
        });
      });
    }
    catch (IndexNotReadyException ignored) {
    }
  }
private void doShowHint(@NotNull QuickEvaluateHandler handler,
                          @NotNull Editor editor,
                          @NotNull Point point,
                          @Nullable EditorMouseEvent event,
                          @NotNull ValueHintType type)