diff --git a/python/src/com/jetbrains/python/codeInsight/PyKeywordCompletionContributor.java b/python/src/com/jetbrains/python/codeInsight/PyKeywordCompletionContributor.java index dbdea20e8c50..5f83b9bf8f5c 100644 --- a/python/src/com/jetbrains/python/codeInsight/PyKeywordCompletionContributor.java +++ b/python/src/com/jetbrains/python/codeInsight/PyKeywordCompletionContributor.java @@ -446,6 +446,17 @@ public class PyKeywordCompletionContributor extends PySeeingOriginalCompletionCo , new PyKeywordCompletionProvider("global", "return", "yield") ); + + extend( + CompletionType.BASIC, psiElement() + .withLanguage(PythonLanguage.getInstance()) + .and(IN_DEF_BODY) + .and(IN_BEGIN_STMT) + .and(PY3K) + .andNot(AFTER_QUALIFIER) + , + new PyKeywordCompletionProvider("nonlocal") + ); } private void addWithinIf() { diff --git a/python/testData/completion/nonlocal.after.py b/python/testData/completion/nonlocal.after.py new file mode 100644 index 000000000000..3929def7a2ae --- /dev/null +++ b/python/testData/completion/nonlocal.after.py @@ -0,0 +1,2 @@ +def foo(): + nonlocal # foo \ No newline at end of file diff --git a/python/testData/completion/nonlocal.py b/python/testData/completion/nonlocal.py new file mode 100644 index 000000000000..9ef453ac73b4 --- /dev/null +++ b/python/testData/completion/nonlocal.py @@ -0,0 +1,2 @@ +def foo(): + nonl # foo \ No newline at end of file