Fix an import names completion issue

This commit is contained in:
Dave Halter
2019-05-17 23:34:17 +02:00
parent 02ab71ff26
commit 4b829c358b
2 changed files with 14 additions and 7 deletions

View File

@@ -352,17 +352,24 @@ class Importer(object):
if os.path.isdir(flaskext): if os.path.isdir(flaskext):
names += self._get_module_names([flaskext]) names += self._get_module_names([flaskext])
for context in self.follow(): contexts = self.follow()
for context in contexts:
# Non-modules are not completable. # Non-modules are not completable.
if context.api_type != 'module': # not a module if context.api_type != 'module': # not a module
continue continue
names += context.sub_modules_dict().values() names += context.sub_modules_dict().values()
if only_modules: if not only_modules:
continue from jedi.evaluate.gradual.conversion import stub_to_actual_context_set
contexts = ContextSet([context])
for filter in context.get_filters(search_global=False): both_contexts = ContextSet.from_sets(
names += filter.values() stub_to_actual_context_set(context, ignore_compiled=True)
for context in contexts
if context.is_stub()
) | contexts
for c in both_contexts:
for filter in c.get_filters(search_global=False):
names += filter.values()
else: else:
if self.level: if self.level:
# We only get here if the level cannot be properly calculated. # We only get here if the level cannot be properly calculated.

View File

@@ -31,7 +31,7 @@ with_stub.in_
#? ['in_with_stub_both', 'in_with_stub_python', 'in_with_stub_stub'] #? ['in_with_stub_both', 'in_with_stub_python', 'in_with_stub_stub']
from stub_folder.with_stub import in_ from stub_folder.with_stub import in_
#? ['with_stub', 'stub_only'] #? ['with_stub', 'stub_only', 'with_stub_folder', 'stub_only_folder']
from stub_folder. from stub_folder.
# ------------------------- # -------------------------