From a4922774c0e1ab9fa171dc91ea69f3898684cada Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Thu, 23 May 2013 01:15:30 +0200 Subject: [PATCH] Fix the previous error --- jedi/api.py | 4 +++- jedi/evaluate.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/jedi/api.py b/jedi/api.py index 05eb60d9..5eedd23c 100644 --- a/jedi/api.py +++ b/jedi/api.py @@ -391,7 +391,9 @@ class Script(object): defs, search_name = evaluate.goto(stmt) definitions = follow_inexistent_imports(defs) if isinstance(user_stmt, pr.Statement): - if user_stmt.get_commands()[0].start_pos > self.pos: + call = user_stmt.get_commands()[0] + if not isinstance(call, (str, unicode)) and \ + call.start_pos > self.pos: # The cursor must be after the start, otherwise the # statement is just an assignee. definitions = [user_stmt] diff --git a/jedi/evaluate.py b/jedi/evaluate.py index 38e0c86b..281b154d 100644 --- a/jedi/evaluate.py +++ b/jedi/evaluate.py @@ -775,7 +775,10 @@ def goto(stmt, call_path=None): commands = stmt.get_commands() assert len(commands) == 1 call = commands[0] - call_path = list(call.generate_call_path()) + if isinstance(call, (str, unicode)): + call_path = [call] + else: + call_path = list(call.generate_call_path()) scope = stmt.get_parent_until(pr.IsScope) pos = stmt.start_pos