void () { if (isSuitableForClass(myPosition)) { for (String s : ModifierChooser.getKeywords(myPosition)) { addKeyword(new OverridableSpace(createKeyword(s), TailTypes.humbleSpaceBeforeWordType())); } if (psiElement().insideStarting(psiElement(PsiLocalVariable.class, PsiExpressionStatement.class)).accepts(myPosition)) { addKeyword(new OverridableSpace(createKeyword(PsiKeyword.CLASS), TailTypes.humbleSpaceBeforeWordType())); addKeyword(new OverridableSpace(LookupElementBuilder.create("abstract class").bold(), TailTypes.humbleSpaceBeforeWordType())); if (HighlightingFeature.RECORDS.isAvailable(myPosition)) { addKeyword(new OverridableSpace(createKeyword(PsiKeyword.RECORD), TailTypes.humbleSpaceBeforeWordType())); } if (HighlightingFeature.LOCAL_ENUMS.isAvailable(myPosition)) { addKeyword(new OverridableSpace(createKeyword(PsiKeyword.ENUM), TailTypes.humbleSpaceBeforeWordType())); } if (HighlightingFeature.LOCAL_INTERFACES.isAvailable(myPosition)) { addKeyword(new OverridableSpace(createKeyword(PsiKeyword.INTERFACE), TailTypes.humbleSpaceBeforeWordType())); } } if (PsiTreeUtil.getParentOfType(myPosition, PsiExpression.class, true, PsiMember.class) == null && PsiTreeUtil.getParentOfType(myPosition, PsiCodeBlock.class, true, PsiMember.class) == null) { List<String> keywords = new ArrayList<>(); keywords.add(PsiKeyword.CLASS); keywords.add(PsiKeyword.INTERFACE); if (HighlightingFeature.RECORDS.isAvailable(myPosition)) { keywords.add(PsiKeyword.RECORD); } if (PsiUtil.isLanguageLevel5OrHigher(myPosition)) { keywords.add(PsiKeyword.ENUM); } String className = recommendClassName(); for (String keyword : keywords) { if (className == null) { addKeyword(new OverridableSpace(createKeyword(keyword), TailTypes.humbleSpaceBeforeWordType())); } else { addKeyword(createTypeDeclaration(keyword, className)); } } } } if (psiElement().withText("@").andNot(psiElement().inside(PsiParameterList.class)).andNot(psiElement().inside(psiNameValuePair())) .accepts(myPrevLeaf)) { addKeyword(new OverridableSpace(createKeyword(PsiKeyword.INTERFACE), TailTypes.humbleSpaceBeforeWordType())); } }