use of com.intellij.codeInsight.lookup.LookupValueWithPsiElement in project intellij-community by JetBrains.
the class CompletionUtil method getTargetElement.
@Nullable
public static PsiElement getTargetElement(LookupElement lookupElement) {
PsiElement psiElement = lookupElement.getPsiElement();
if (psiElement != null && psiElement.isValid()) {
return getOriginalElement(psiElement);
}
Object object = lookupElement.getObject();
if (object instanceof LookupValueWithPsiElement) {
final PsiElement element = ((LookupValueWithPsiElement) object).getElement();
if (element != null && element.isValid())
return getOriginalElement(element);
}
return null;
}
Aggregations