void () { PsiElementPattern.Capture<PsiElement> inStatement = psiElement() .withLanguage(PythonLanguage.getInstance()) .and(IN_BEGIN_STMT) .andNot(IN_IMPORT_STMT) .andNot(IN_PARAM_LIST) .andNot(IN_ARG_LIST) .andNot(BEFORE_COND) .andNot(AFTER_QUALIFIER) .andNot(IN_STRING_LITERAL); extend( CompletionType.BASIC, inStatement, new CompletionProvider<>() { @Override protected void addCompletions( @NotNull final CompletionParameters parameters, @NotNull final ProcessingContext context, @NotNull final CompletionResultSet result ) { putKeywords(result, TailTypes.spaceType(), PyNames.ASSERT, PyNames.DEL, PyNames.EXEC, PyNames.FROM, PyNames.IMPORT, PyNames.RAISE); putKeywords(result, TailTypes.noneType(), PyNames.PASS); } } ); extend(CompletionType.BASIC, inStatement.andNot(PY3K), new PyKeywordCompletionProvider(TailTypes.spaceType(), PyNames.PRINT)); }