void () { PsiLoopStatement loop = PsiTreeUtil.getParentOfType(myPosition, PsiLoopStatement.class, true, PsiLambdaExpression.class, PsiMember.class); LookupElement br = createKeyword(PsiKeyword.BREAK); LookupElement cont = createKeyword(PsiKeyword.CONTINUE); TailType tailType; if (psiElement().insideSequence(true, psiElement(PsiLabeledStatement.class), or(psiElement(PsiFile.class), psiElement(PsiMethod.class), psiElement(PsiClassInitializer.class))).accepts(myPosition)) { tailType = TailTypes.humbleSpaceBeforeWordType(); } else { tailType = TailTypes.semicolonType(); } br = TailTypeDecorator.withTail(br, tailType); cont = TailTypeDecorator.withTail(cont, tailType); if (loop != null && PsiTreeUtil.isAncestor(loop.getBody(), myPosition, false)) { addKeyword(br); addKeyword(cont); } if (psiElement().inside(PsiSwitchStatement.class).accepts(myPosition)) { addKeyword(br); } else if (psiElement().inside(PsiSwitchExpression.class).accepts(myPosition) && HighlightingFeature.SWITCH_EXPRESSION.isAvailable(myPosition)) { addKeyword(TailTypeDecorator.withTail(createKeyword(PsiKeyword.YIELD), TailTypes.insertSpaceType())); } for (PsiLabeledStatement labeled : psiApi().parents(myPosition).takeWhile(notInstanceOf(PsiMember.class)) .filter(PsiLabeledStatement.class)) { addKeyword(TailTypeDecorator.withTail(LookupElementBuilder.create("break " + labeled.getName()).bold(), TailTypes.semicolonType())); } }