diff --git a/python/src/com/jetbrains/python/codeInsight/completion/PyKeywordCompletionContributor.java b/python/src/com/jetbrains/python/codeInsight/completion/PyKeywordCompletionContributor.java index 5e73dd7c0243..ab13a59ff0b8 100644 --- a/python/src/com/jetbrains/python/codeInsight/completion/PyKeywordCompletionContributor.java +++ b/python/src/com/jetbrains/python/codeInsight/completion/PyKeywordCompletionContributor.java @@ -649,8 +649,13 @@ public class PyKeywordCompletionContributor extends CompletionContributor { extend(CompletionType.BASIC, psiElement() .withLanguage(PythonLanguage.getInstance()) - .inside(false, psiElement(PyAssignmentStatement.class), psiElement(PyTargetExpression.class)) - .afterLeaf("=", "("), + .andOr(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.YIELD)); } diff --git a/python/testSrc/com/jetbrains/python/PythonKeywordCompletionTest.java b/python/testSrc/com/jetbrains/python/PythonKeywordCompletionTest.java index e957ea50b74b..e64f02ad16c3 100644 --- a/python/testSrc/com/jetbrains/python/PythonKeywordCompletionTest.java +++ b/python/testSrc/com/jetbrains/python/PythonKeywordCompletionTest.java @@ -204,6 +204,10 @@ public class PythonKeywordCompletionTest extends PyTestCase { assertContainsElements(doTestByText("def gen(): x = "), "yield"); assertDoesntContain(doTestByText("def gen(): x = 1 + "), "yield"); assertContainsElements(doTestByText("def gen(): x = 1 + ("), "yield"); + assertContainsElements(doTestByText("def gen(): x **= "), "yield"); + assertDoesntContain(doTestByText("def gen(): func()"), "yield"); + assertContainsElements(doTestByText("def gen(): func(("), "yield"); + assertDoesntContain(doTestByText("def gen(): x = y = 42"), "yield"); } public void testExceptAfterElse() {