From b6e9f16a0142436bafff1f730727837763af35ee Mon Sep 17 00:00:00 2001 From: David Halter Date: Wed, 17 Jul 2013 16:48:50 +0200 Subject: [PATCH] fix a completion problem on docstrings --- jedi/api.py | 5 ++--- test/test_regression.py | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/jedi/api.py b/jedi/api.py index 18ddb4f6..aef2f764 100644 --- a/jedi/api.py +++ b/jedi/api.py @@ -155,9 +155,8 @@ class Script(object): and n.lower().startswith(like.lower()) \ or n.startswith(like): if not evaluate.filter_private_variable(s, - self._parser.user_stmt, n): - new = api_classes.Completion(c, needs_dot, - len(like), s) + self._parser.user_stmt or self._parser.user_scope, n): + new = api_classes.Completion(c, needs_dot, len(like), s) k = (new.name, new.complete) # key if k in comp_dct and settings.no_completion_duplicates: comp_dct[k]._same_name_completions.append(new) diff --git a/test/test_regression.py b/test/test_regression.py index 3753d0bf..6c17238e 100755 --- a/test/test_regression.py +++ b/test/test_regression.py @@ -459,6 +459,12 @@ class TestDocstring(TestBase): docs = [d.raw_doc for d in defs] self.assertEqual(docs, ['Original docstring.', 'Docstring of `x`.']) + def test_completion(self): + assert self.completions(''' + class DocstringCompletion(): + #? [] + """ asdfas """''') + class TestFeature(TestBase):