1
0
forked from VimPlug/jedi

Replace get_all_import_names with a leaf search method in Simple.

This commit is contained in:
Dave Halter
2014-11-19 01:31:08 +01:00
parent bab6788b42
commit 1c240e75d3
2 changed files with 19 additions and 27 deletions

View File

@@ -25,22 +25,9 @@ def get_on_import_stmt(evaluator, user_context, user_stmt, is_like_search=False)
Resolve the user statement, if it is an import. Only resolve the
parts until the user position.
"""
import_names = user_stmt.get_all_import_names()
kill_count = -1
cur_name_part = None
for name in import_names:
if user_stmt.alias == name:
continue
name = user_stmt.leaf_for_position(user_context.position)
if name is None:
raise NotImplementedError
if name.end_pos >= user_context.position:
if not cur_name_part:
cur_name_part = name
kill_count += 1
context = user_context.get_context()
just_from = next(context) == 'from'
i = imports.ImportWrapper(evaluator, user_stmt, is_like_search,
kill_count=kill_count, nested_resolve=True,
is_just_from=just_from)
return i, cur_name_part
i = imports.ImportWrapper(evaluator, name)
return i, name