void (PsiElement context, GroovyCompletionConsumer result) { if (isControlStructure(context)) { result.consume(keyword(PsiKeyword.TRY, JavaTailTypes.TRY_LBRACE)); result.consume(keyword(PsiKeyword.WHILE, JavaTailTypes.WHILE_LPARENTH)); result.consume(keyword(PsiKeyword.SWITCH, JavaTailTypes.SWITCH_LPARENTH)); result.consume(keyword(PsiKeyword.FOR, JavaTailTypes.FOR_LPARENTH)); result.consume(keyword(PsiKeyword.THROW, TailTypes.humbleSpaceBeforeWordType())); result.consume(keyword(PsiKeyword.ASSERT, TailTypes.humbleSpaceBeforeWordType())); result.consume(keyword(PsiKeyword.SYNCHRONIZED, JavaTailTypes.SYNCHRONIZED_LPARENTH)); result.consume(keyword(PsiKeyword.RETURN, hasReturnValue(context) ? TailTypes.humbleSpaceBeforeWordType() : TailTypes.noneType())); } if (inCaseSection(context)) { boolean isArrowAllowed = GroovyConfigUtils.isAtLeastGroovy40(context); TailType defaultType = isArrowAllowed ? JavaTailTypes.CASE_ARROW : TailTypes.caseColonType(); result.consume(keyword("case", TailTypes.humbleSpaceBeforeWordType())); result.consume(keyword("default", defaultType)); } if (afterTry(context)) { result.consume(keyword(PsiKeyword.CATCH, JavaTailTypes.CATCH_LPARENTH)); result.consume(keyword(PsiKeyword.FINALLY, JavaTailTypes.FINALLY_LBRACE)); } if (afterIfOrElse(context)) { result.consume(keyword(PsiKeyword.ELSE, TailTypes.humbleSpaceBeforeWordType())); } if (WHILE_KEYWORD_POSITION.accepts(context)) { result.consume(keyword(PsiKeyword.WHILE, JavaTailTypes.WHILE_LPARENTH)); } if (isCommandCallWithOneArg(context)) { result.consume(keyword(PsiKeyword.ASSERT, TailTypes.humbleSpaceBeforeWordType())); if (hasReturnValue(context)) { result.consume(keyword(PsiKeyword.RETURN, TailTypes.humbleSpaceBeforeWordType())); } } }