@Override
    public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
      if (value instanceof PsiItemWithSimilarity<?> itemWithSimilarity) {
        return getListCellRendererComponent(list, itemWithSimilarity.getValue(), index, isSelected, cellHasFocus);
      }
      ItemWithPresentation<?> itemAndPresentation = (ItemWithPresentation<?>)value;

      TargetPresentation presentation = itemAndPresentation.getPresentation();
      PsiElementListCellRenderer.ItemMatchers matchers = getItemMatchers(list, itemAndPresentation);

      removeAll();

      Color bgColor = isSelected ? UIUtil.getListSelectionBackground(true) : presentation.getBackgroundColor();
      setBackground(bgColor);

      JLabel locationLabel;
      if (StringUtil.isNotEmpty(presentation.getLocationText())) {
        locationLabel = new JLabel(presentation.getLocationText(), presentation.getLocationIcon(), SwingConstants.RIGHT);
        locationLabel.setHorizontalTextPosition(SwingConstants.LEFT);
        locationLabel.setIconTextGap(RendererPanelsUtils.getIconTextGap());
        locationLabel.setForeground(isSelected ? NamedColorUtil.getListSelectionForeground(true) : NamedColorUtil.getInactiveTextColor());
        add(locationLabel, BorderLayout.EAST);
      }
      else {
        locationLabel = null;
      }

      ColoredListCellRenderer<Object> leftRenderer = new ColoredListCellRenderer<>() {
        @Override
        protected void customizeCellRenderer(@NotNull JList list, Object value, int index, boolean selected, boolean hasFocus) {
          //noinspection UseDPIAwareInsets
          setIpad(new Insets(0, 0, 0, getIpad().right)); // Border of top panel is used for around insets of renderer
          setIcon(presentation.getIcon());
          setIconTextGap(RendererPanelsUtils.getIconTextGap());
          SimpleTextAttributes nameAttributes = presentation.getPresentableTextAttributes() != null
                                                ? SimpleTextAttributes.fromTextAttributes(presentation.getPresentableTextAttributes())
                                                : new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, null);
          SpeedSearchUtil.appendColoredFragmentForMatcher(presentation.getPresentableText(), this, nameAttributes, matchers.nameMatcher,
                                                          bgColor, selected);
          if (presentation.getContainerText() != null) {
            Insets listInsets = list.getInsets();
            Insets rendererInsets = getInsets();
            FontMetrics fm = list.getFontMetrics(list.getFont());
            int containerMaxWidth = list.getWidth() - listInsets.left - listInsets.right
                                    - rendererInsets.left - rendererInsets.right
                                    - getPreferredSize().width;
            if (locationLabel != null) containerMaxWidth -= locationLabel.getPreferredSize().width;

            @NlsSafe String containerText = PSIRenderingUtils.cutContainerText(presentation.getContainerText(), containerMaxWidth, fm);
            SimpleTextAttributes containerAttributes = presentation.getContainerTextAttributes() != null
                                                       ? SimpleTextAttributes.fromTextAttributes(presentation.getContainerTextAttributes())
                                                       : SimpleTextAttributes.GRAYED_ATTRIBUTES;
            SpeedSearchUtil.appendColoredFragmentForMatcher(" " + containerText, this, containerAttributes, matchers.locationMatcher,
                                                            bgColor, selected);
          }
        }
      };
      add(leftRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus), BorderLayout.WEST);
      accessibleContext = leftRenderer.getAccessibleContext();
      return this;
    }
@Override
    public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus)