void () { extend( CompletionType.BASIC, psiElement() .withLanguage(PythonLanguage.getInstance()) .and(IN_DEF_BODY) .and(IN_BEGIN_STMT) .andNot(AFTER_QUALIFIER) , new PyKeywordCompletionProvider(PyNames.GLOBAL, PyNames.RETURN, PyNames.YIELD) ); extend( CompletionType.BASIC, psiElement() .withLanguage(PythonLanguage.getInstance()) .and(IN_DEF_BODY) .and(IN_BEGIN_STMT) .and(PY3K) .andNot(AFTER_QUALIFIER) , new PyKeywordCompletionProvider(PyNames.NONLOCAL) ); extend(CompletionType.BASIC, psiElement() .withLanguage(PythonLanguage.getInstance()) .and(PY35) .andNot(AFTER_QUALIFIER) .with(new PatternCondition<>("insideAsyncDef") { @Override public boolean accepts(@NotNull PsiElement element, ProcessingContext context) { final ScopeOwner owner = ScopeUtil.getScopeOwner(element); return owner instanceof PyFunction && ((PyFunction)owner).isAsync(); } }) .andOr(IN_BEGIN_STMT, psiElement() .inside(false, psiElement(PyAssignmentStatement.class), psiElement(PyTargetExpression.class)) .afterLeaf(psiElement().withElementType(PyTokenTypes.EQ)), psiElement() .inside(false, psiElement(PyAugAssignmentStatement.class), psiElement(PyTargetExpression.class)) .afterLeaf(psiElement().withElementType(PyTokenTypes.AUG_ASSIGN_OPERATIONS)), psiElement().inside(true, psiElement(PyParenthesizedExpression.class))), new PyKeywordCompletionProvider(PyNames.AWAIT)); }