void (CompletionParameters parameters, CompletionResultSet result) { if (parameters.getCompletionType() != CompletionType.BASIC && parameters.getCompletionType() != CompletionType.SMART) { return; } PsiElement position = parameters.getPosition(); if (DumbService.getInstance(position.getProject()).isDumb()) { return; } if (psiElement(PsiIdentifier.class).withParents(PsiJavaCodeReferenceElement.class, PsiTypeElement.class, PsiClass.class). andNot(JavaKeywordCompletion.AFTER_DOT).accepts(position)) { PsiElement prevLeaf = PsiTreeUtil.prevVisibleLeaf(position); PsiModifierList modifierList = PsiTreeUtil.getParentOfType(prevLeaf, PsiModifierList.class); if (modifierList != null) { String fileText = position.getContainingFile().getText(); result = result.withPrefixMatcher(new NoMiddleMatchesAfterSpace( fileText.substring(modifierList.getTextRange().getStartOffset(), parameters.getOffset()))); } suggestGeneratedMethods(result, position, modifierList); } else if (isTypingAnnotationForNewMember(position)) { PsiAnnotation annotation = Objects.requireNonNull(PsiTreeUtil.getParentOfType(position, PsiAnnotation.class)); int annoStart = annotation.getTextRange().getStartOffset(); result.addElement(itemWithOverrideImplementDialog()); suggestGeneratedMethods( result.withPrefixMatcher(new NoMiddleMatchesAfterSpace(annotation.getText().substring(0, parameters.getOffset() - annoStart))), position, (PsiModifierList)annotation.getParent()); } }