1
0
forked from VimPlug/jedi

Actually do goto when follow_imports is used

Fixes #945.
This commit is contained in:
Dave Halter
2017-09-13 00:28:49 +02:00
parent 5a8b9541a7
commit 5ff7e3dbbe
3 changed files with 25 additions and 14 deletions

View File

@@ -141,6 +141,7 @@ def get_init_path(directory_path):
class ImportName(AbstractNameDefinition):
start_pos = (1, 0)
_level = 0
def __init__(self, parent_context, string_name):
self.parent_context = parent_context
@@ -151,8 +152,12 @@ class ImportName(AbstractNameDefinition):
self.parent_context.evaluator,
[self.string_name],
self.parent_context,
level=self._level,
).follow()
def goto(self):
return [m.name for m in self.infer()]
def get_root_context(self):
# Not sure if this is correct.
return self.parent_context.get_root_context()
@@ -163,13 +168,7 @@ class ImportName(AbstractNameDefinition):
class SubModuleName(ImportName):
def infer(self):
return Importer(
self.parent_context.evaluator,
[self.string_name],
self.parent_context,
level=1
).follow()
_level = 1
class Importer(object):