mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
PY-11375 Fix 'yield' keyword completion in yield expressions
This commit is contained in:
+7
-2
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -204,6 +204,10 @@ public class PythonKeywordCompletionTest extends PyTestCase {
|
||||
assertContainsElements(doTestByText("def gen(): x = <caret>"), "yield");
|
||||
assertDoesntContain(doTestByText("def gen(): x = 1 + <caret>"), "yield");
|
||||
assertContainsElements(doTestByText("def gen(): x = 1 + (<caret>"), "yield");
|
||||
assertContainsElements(doTestByText("def gen(): x **= <caret>"), "yield");
|
||||
assertDoesntContain(doTestByText("def gen(): func(<caret>)"), "yield");
|
||||
assertContainsElements(doTestByText("def gen(): func((<caret>"), "yield");
|
||||
assertDoesntContain(doTestByText("def gen(): x = y<caret> = 42"), "yield");
|
||||
}
|
||||
|
||||
public void testExceptAfterElse() {
|
||||
|
||||
Reference in New Issue
Block a user