diff --git a/jedi/evaluate.py b/jedi/evaluate.py index 8d68b050..d5350a57 100644 --- a/jedi/evaluate.py +++ b/jedi/evaluate.py @@ -159,6 +159,10 @@ def get_names_of_scope(scope, position=None, star_search=True, in_func_scope = scope non_flow = scope.get_parent_until(pr.Flow, reverse=True) while scope: + if isinstance(scope, pr.SubModule) and scope.parent: + # we don't want submodules to report if we have modules. + scope = scope.parent + continue # `pr.Class` is used, because the parent is never `Class`. # Ignore the Flows, because the classes and functions care for that. # InstanceElement of Class is ignored, if it is not the start scope. diff --git a/jedi/fast_parser.py b/jedi/fast_parser.py index 2413dea2..30724e37 100644 --- a/jedi/fast_parser.py +++ b/jedi/fast_parser.py @@ -392,6 +392,7 @@ class FastParser(use_metaclass(CachedFastParser)): p = parsing.Parser(parser_code, self.module_path, self.user_position, offset=(line_offset, 0), is_fast_parser=True, top_module=self.module) + p.module.parent = self.module else: node = nodes.pop(index) p = node.parser