1
0
forked from VimPlug/jedi

Last few on_import fixes.

This commit is contained in:
Dave Halter
2014-12-08 14:15:21 +01:00
parent 6cc4d71822
commit 034d782e65
4 changed files with 26 additions and 33 deletions

View File

@@ -144,14 +144,15 @@ class Script(object):
# TODO this paragraph is necessary, but not sure it works.
context = self._user_context.get_context()
next(context) # skip the path
if False and next(context) == 'from':
if next(context) == 'from':
# completion is just "import" if before stands from ..
completions += ((k, bs) for k in keywords.keyword_names('import'))
module = self._parser.module()
name = user_stmt.name_for_position(self._pos)
imp = imports.ImportWrapper(self._evaluator, name)
completions += [(n, module) for n in imp.completions()]
if name is not None:
imp = imports.ImportWrapper(self._evaluator, name)
completions += [(n, module) for n in imp.completion_names()]
if importer or isinstance(user_stmt, pr.Import):
return completions

View File

@@ -57,7 +57,7 @@ def importer_from_error_statement(evaluator, module, error_statement, pos):
elif typ == 'import_from':
for node in nodes:
if isinstance(node, pt.Node) and node.type == 'dotted_name':
names += check_dotted(node.children[::2])
names += check_dotted(node.children)
elif node in ('.', '...'):
level += len(node.value)
elif isinstance(node, pt.Name) and node.end_pos < pos: