From 54d9d325dac4653d97933202840cba59b411242e Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Fri, 28 Mar 2014 02:08:22 +0100 Subject: [PATCH] temporary fix for #315. in the future we should be removing that whole indent change crap --- jedi/api/__init__.py | 10 +++++++--- test/completion/goto.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index 08dc3e80..e2d28880 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -248,9 +248,13 @@ class Script(object): stmt = r.module.statements[-1] except IndexError: raise NotFoundError() - # Set the start_pos to a pseudo position, that doesn't exist but works - # perfectly well (for both completions in docstrings and statements). - stmt.start_pos = self._pos + user_stmt = self._parser.user_stmt() + if user_stmt is None or isinstance(user_stmt, pr.Param): + # Set the start_pos to a pseudo position, that doesn't exist but works + # perfectly well (for both completions in docstrings and statements). + stmt.start_pos = self._pos + else: + stmt.start_pos = user_stmt.start_pos[0], user_stmt.start_pos[1] - 1 stmt.parent = self._parser.user_scope() return stmt diff --git a/test/completion/goto.py b/test/completion/goto.py index 663c15d7..58ab2e6b 100644 --- a/test/completion/goto.py +++ b/test/completion/goto.py @@ -93,7 +93,7 @@ ClassVar().x = '' # Recurring use of the same var name, github #315 def f(t=None): - #! 9 ['t=None'] + #! 9 ['t = None'] t = t or 1 # -----------------