fix a completion problem on docstrings

This commit is contained in:
David Halter
2013-07-17 16:48:50 +02:00
parent 8490b1d0ff
commit b6e9f16a01
2 changed files with 8 additions and 3 deletions

View File

@@ -155,9 +155,8 @@ class Script(object):
and n.lower().startswith(like.lower()) \ and n.lower().startswith(like.lower()) \
or n.startswith(like): or n.startswith(like):
if not evaluate.filter_private_variable(s, if not evaluate.filter_private_variable(s,
self._parser.user_stmt, n): self._parser.user_stmt or self._parser.user_scope, n):
new = api_classes.Completion(c, needs_dot, new = api_classes.Completion(c, needs_dot, len(like), s)
len(like), s)
k = (new.name, new.complete) # key k = (new.name, new.complete) # key
if k in comp_dct and settings.no_completion_duplicates: if k in comp_dct and settings.no_completion_duplicates:
comp_dct[k]._same_name_completions.append(new) comp_dct[k]._same_name_completions.append(new)

View File

@@ -459,6 +459,12 @@ class TestDocstring(TestBase):
docs = [d.raw_doc for d in defs] docs = [d.raw_doc for d in defs]
self.assertEqual(docs, ['Original docstring.', 'Docstring of `x`.']) self.assertEqual(docs, ['Original docstring.', 'Docstring of `x`.'])
def test_completion(self):
assert self.completions('''
class DocstringCompletion():
#? []
""" asdfas """''')
class TestFeature(TestBase): class TestFeature(TestBase):