String (LookupItem<?> item) { final String presentableText = item.getPresentableText(); if (presentableText != null) return presentableText; final Object o = item.getObject(); String name = null; if (o instanceof PsiElement element) { if (element.isValid()) { name = PsiUtilCore.getName(element); } } else if (o instanceof PsiMetaData) { name = ((PsiMetaData)o).getName(); } else if (o instanceof PresentableLookupValue ) { name = ((PresentableLookupValue)o).getPresentation(); } else { name = String.valueOf(o); } if (name == null){ name = ""; } return name; }