forked from VimPlug/jedi
More fixes for ExprStmt docstrings.
This commit is contained in:
@@ -69,9 +69,10 @@ class DocstringMixin(object):
|
|||||||
stmt = self.children[self.children.index(':') + 1]
|
stmt = self.children[self.children.index(':') + 1]
|
||||||
if is_node(stmt, 'suite'): # Normally a suite
|
if is_node(stmt, 'suite'): # Normally a suite
|
||||||
stmt = stmt.children[2] # -> NEWLINE INDENT stmt
|
stmt = stmt.children[2] # -> NEWLINE INDENT stmt
|
||||||
else:
|
else: # ExprStmt
|
||||||
c = self.parent.children
|
simple_stmt = self.parent
|
||||||
index = c.index(self) - 1
|
c = simple_stmt.parent.children
|
||||||
|
index = c.index(simple_stmt)
|
||||||
if not index:
|
if not index:
|
||||||
return ''
|
return ''
|
||||||
stmt = c[index - 1]
|
stmt = c[index - 1]
|
||||||
|
|||||||
@@ -129,6 +129,11 @@ def test_completion_docstring():
|
|||||||
docstr('import jedi\njedi.Scr', cleandoc(Script.__doc__))
|
docstr('import jedi\njedi.Scr', cleandoc(Script.__doc__))
|
||||||
|
|
||||||
docstr('abcd=3;abcd', '')
|
docstr('abcd=3;abcd', '')
|
||||||
|
docstr('"hello"\nabcd=3\nabcd', 'hello')
|
||||||
|
# It works with a ; as well.
|
||||||
|
docstr('"hello"\nabcd=3;abcd', 'hello')
|
||||||
|
# Shouldn't work with a tuple.
|
||||||
|
docstr('"hello",0\nabcd=3\nabcd', '')
|
||||||
|
|
||||||
|
|
||||||
def test_completion_params():
|
def test_completion_params():
|
||||||
|
|||||||
Reference in New Issue
Block a user