Dimension (@Nullable Container parent) { int maxCellWidth = myLookup.myCellRenderer.getLookupTextWidth() + myLookup.myCellRenderer.getTextIndent(); int scrollBarWidth = myScrollPane.getVerticalScrollBar().getWidth(); int listWidth = Math.min(scrollBarWidth + maxCellWidth, UISettings.getInstance().getMaxLookupWidth()); Dimension bottomPanelSize = myBottomPanel != null ? myBottomPanel.getPreferredSize() : new Dimension(); int panelHeight = myScrollPane.getPreferredSize().height + bottomPanelSize.height; int width = Math.max(listWidth, bottomPanelSize.width); width = Math.min(width, Registry.intValue("ide.completion.max.width")); int height = Math.min(panelHeight, myMaximumHeight); return new Dimension(width, height); }