boolean (LookupElement shorterElement, LookupElement longerElement) { Object object = shorterElement.getObject(); if (object instanceof PsiClass psiClass && longerElement.getObject() instanceof PsiClass) { PsiFile file = psiClass.getContainingFile(); if (file != null) { VirtualFile vFile = file.getOriginalFile().getVirtualFile(); if (vFile != null && fileIndex.isInSource(vFile)) { return true; } } } return false; }