1
0
forked from VimPlug/jedi

also add scope_names_generator to the iterable module classes, as well as cleaning up some old scope_names_generator stuff

This commit is contained in:
Dave Halter
2014-07-02 18:58:31 +02:00
parent 13ada3154b
commit a7e4d81692
3 changed files with 25 additions and 40 deletions

View File

@@ -218,26 +218,20 @@ class Script(object):
for s in scopes:
if s.isinstance(er.Function):
names = s.get_magic_function_names()
else:
if isinstance(s, imports.ImportWrapper):
under = like + self._user_context.get_path_after_cursor()
if under == 'import':
current_line = self._user_context.get_position_line()
if not current_line.endswith('import import'):
continue
a = s.import_stmt.alias
if a and a.start_pos <= self._pos <= a.end_pos:
elif isinstance(s, imports.ImportWrapper):
under = like + self._user_context.get_path_after_cursor()
if under == 'import':
current_line = self._user_context.get_position_line()
if not current_line.endswith('import import'):
continue
names = s.get_defined_names(on_import_stmt=True)
else:
try:
sng = s.scope_names_generator
except AttributeError:
names = s.get_defined_names()
else:
names = []
for _, new_names in sng():
names += new_names
a = s.import_stmt.alias
if a and a.start_pos <= self._pos <= a.end_pos:
continue
names = s.get_defined_names(on_import_stmt=True)
else:
names = []
for _, new_names in s.scope_names_generator():
names += new_names
for c in names:
completions.append((c, s))