1
0
forked from VimPlug/jedi

Import completion improvements.

This commit is contained in:
Dave Halter
2014-12-08 13:47:23 +01:00
parent 7cc2a07cd3
commit 6cc4d71822
3 changed files with 27 additions and 16 deletions
+6 -2
View File
@@ -47,13 +47,17 @@ class ImportWrapper(pr.Base):
self.import_path = self._import.path_for_name(name)
self.is_like_search = False # TODO REMOVE
def get_defined_names(self):
def completions(self):
# The import path needs to be reduced by one, because we're completing.
import_path = self.import_path[:-1]
module = self._import.get_parent_until()
importer = get_importer(self._evaluator, tuple(import_path),
module, self._import.level)
only_modules = isinstance(self._import, pr.ImportName)
if isinstance(self._import, pr.ImportFrom):
c = self._import.children
only_modules = c[c.index('import')].start_pos >= self._name.start_pos
else:
only_modules = True
return importer.completion_names(self._evaluator, only_modules)
@memoize_default()