From 75ffc7cf729aafa7d085c820c8b1626d7d860947 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 19 Nov 2010 19:43:10 +0300 Subject: [PATCH] completion for 'nonlocal' keyword (PY-2289) --- .../codeInsight/PyKeywordCompletionContributor.java | 11 +++++++++++ python/testData/completion/nonlocal.after.py | 2 ++ python/testData/completion/nonlocal.py | 2 ++ 3 files changed, 15 insertions(+) create mode 100644 python/testData/completion/nonlocal.after.py create mode 100644 python/testData/completion/nonlocal.py 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