mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
fix a completion problem on docstrings
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -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):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user