1
0
forked from VimPlug/jedi

First implementation to be ready to complete corrupt imports. Working ok.

This commit is contained in:
Dave Halter
2014-11-25 19:35:27 +01:00
parent e72eaf7a59
commit 5d82b11f59
7 changed files with 144 additions and 7 deletions

View File

@@ -129,6 +129,14 @@ class Script(object):
:rtype: list of :class:`classes.Completion`
"""
def get_completions(user_stmt, bs):
if user_stmt is None:
module = self._parser.module()
importer = helpers.check_error_statements(
self._evaluator, module, self._pos
)
print(importer.completion_names(self._evaluator, True))
return [(name, module) for name in importer.completion_names(self._evaluator, True)]
# TODO DELETE still needed?
if isinstance(user_stmt, pr.Import):
context = self._user_context.get_context()
next(context) # skip the path
@@ -155,6 +163,7 @@ class Script(object):
path, dot, like = helpers.completion_parts(path)
user_stmt = self._parser.user_stmt_with_whitespace()
b = compiled.builtin
completions = get_completions(user_stmt, b)