From acd648889123d93faad122cd80a6a8dfaaf97bb9 Mon Sep 17 00:00:00 2001 From: David Halter Date: Sun, 2 Sep 2012 11:52:49 +0200 Subject: [PATCH] fix for github issue 7, goto function works now right for 'from import' statements --- functions.py | 4 ++++ test/completion/goto.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/functions.py b/functions.py index 4f0401f8..6ef49512 100644 --- a/functions.py +++ b/functions.py @@ -276,6 +276,10 @@ def goto(source, line, column, source_path): for s in scopes: if isinstance(s, imports.ImportPath): s = s.follow()[0] + try: + s = evaluate.statement_path[0] + except IndexError: + pass definitions.append(s) else: def remove_unreal_imports(names): diff --git a/test/completion/goto.py b/test/completion/goto.py index 348beefe..bf2d783b 100644 --- a/test/completion/goto.py +++ b/test/completion/goto.py @@ -103,3 +103,6 @@ mod1.a from import_tree import mod1 #! ['a=1'] mod1.a + +#! ['a=1.0'] +from import_tree.pkg.mod1 import a