Search in sources :

Example 1 with LookupValueWithPsiElement

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;
}
Also used : LookupValueWithPsiElement(com.intellij.codeInsight.lookup.LookupValueWithPsiElement) LookupValueWithPsiElement(com.intellij.codeInsight.lookup.LookupValueWithPsiElement) PsiElement(com.intellij.psi.PsiElement) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

LookupValueWithPsiElement (com.intellij.codeInsight.lookup.LookupValueWithPsiElement)1 PsiElement (com.intellij.psi.PsiElement)1 Nullable (org.jetbrains.annotations.Nullable)1