mirror of
https://github.com/davidhalter/jedi.git
synced 2026-11-07 03:15:58 +08:00
Import completion improvements.
This commit is contained in:
1 parent
7cc2a07cd3
commit
6cc4d71822
3 files changed
+27
-16
No files matched your search
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user