private @NotNull Point getPopupLocation() {
    Point location;
    try {
      Rectangle view = myEditor.modelToView(caretPosition);
      location = new Point((int)view.getMaxX(), (int)view.getMaxY());
    }
    catch (BadLocationException ignore) {
      location = myEditor.getCaret().getMagicCaretPosition();
    }

    SwingUtilities.convertPointToScreen(location, myEditor);
    location.x -= getXOffset() + JBUIScale.scale(2);
    location.y += 2;

    return location;
  }
private @NotNull Point getPopupLocation()