boolean (@NotNull PsiReference ref, @NotNull PsiElement target) { PsiElement refElement = ref.getElement(); if (refElement.getContainingFile().getLanguage().getID().equals("GWT JavaScript")) { // for GWT class members refs like "MyClass::mmm(I)(1)", lookup items are only a subset of possible reference texts return false; } if (refElement instanceof PsiJavaCodeReferenceElement && !shouldSuggestJavaTarget((PsiJavaCodeReferenceElement)refElement, target)) { return false; } if (ref instanceof FileReference) { if (target instanceof PsiFile) { return false; // IDEA-177167 } if (target instanceof PsiDirectory && ((PsiDirectory)target).getName().endsWith(".jar") && ((PsiDirectory)target).getParentDirectory() == null) { return false; // IDEA-178629 } } if (refElement instanceof PsiNameValuePair && PsiUtil.isAnnotationMethod(target) && PsiTypes.booleanType().equals(((PsiMethod)target).getReturnType())) { return false; // they're suggested, but with true/false value text (IDEA-121071) } return super.shouldSuggestReferenceText(ref, target); }