From fcc6c4d811767b79ead0705057c938a9761d1b67 Mon Sep 17 00:00:00 2001 From: David Halter Date: Fri, 6 Sep 2013 14:56:35 +0430 Subject: [PATCH] goto before assignments should still work, 305 --- jedi/api.py | 5 +++-- test/completion/goto.py | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/jedi/api.py b/jedi/api.py index 333ea452..85c74acc 100644 --- a/jedi/api.py +++ b/jedi/api.py @@ -441,8 +441,9 @@ class Script(object): definitions = follow_inexistent_imports(defs) if isinstance(user_stmt, pr.Statement): c = user_stmt.get_commands() - if c and not isinstance(c[0], (str, unicode)) and \ - c[0].start_pos > self._pos: + if c and not isinstance(c[0], (str, unicode)) \ + and c[0].start_pos > self._pos \ + and not re.search(r'\.\w+$', goto_path): # The cursor must be after the start, otherwise the # statement is just an assignee. definitions = [user_stmt] diff --git a/test/completion/goto.py b/test/completion/goto.py index 7c779328..7e3fcacf 100644 --- a/test/completion/goto.py +++ b/test/completion/goto.py @@ -78,9 +78,9 @@ c() class BeforeAssignment(): x = 3 - def __init__(self): - #! 13 ['x = 3'] - self.x = '' + +#! 18 ['x = 3'] +BeforeAssignment.x = '' # ----------------- # imports