LookupElement (@NotNull PsiExpression expression) { if (expression instanceof PsiReferenceExpression refExpr && !refExpr.isQualified() && refExpr.resolve() instanceof PsiVariable var) { final VariableLookupItem item = new VariableLookupItem(var); item.setSubstitutor(PsiSubstitutor.EMPTY); return item; } if (expression instanceof PsiMethodCallExpression call && !call.getMethodExpression().isQualified()) { final PsiMethod method = call.resolveMethod(); if (method != null) { return new JavaMethodCallElement(method); } } return new ExpressionLookupItem(expression); }