forked from VimPlug/jedi
Fix a globals context issue, fixes #1435
This commit is contained in:
@@ -101,7 +101,7 @@ class ModuleMixin(SubModuleDictMixin):
|
||||
parent_context=self.as_context(),
|
||||
origin_scope=origin_scope
|
||||
),
|
||||
GlobalNameFilter(self, self.tree_node),
|
||||
GlobalNameFilter(self.as_context(), self.tree_node),
|
||||
)
|
||||
yield DictFilter(self.sub_modules_dict())
|
||||
yield DictFilter(self._module_attributes_dict())
|
||||
|
||||
@@ -188,6 +188,14 @@ def init_global_var_predefined():
|
||||
global_var_predefined
|
||||
|
||||
|
||||
def global_as_import():
|
||||
from import_tree import globals
|
||||
#? ['foo']
|
||||
globals.foo
|
||||
#? int()
|
||||
globals.foo
|
||||
|
||||
|
||||
# -----------------
|
||||
# within docstrs
|
||||
# -----------------
|
||||
|
||||
5
test/completion/import_tree/globals.py
Normal file
5
test/completion/import_tree/globals.py
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
def something():
|
||||
global foo
|
||||
foo = 3
|
||||
@@ -75,7 +75,7 @@ from import_tree.pkg.mod1 import not_existant, # whitespace before
|
||||
from import_tree.pkg.mod1 import not_existant,
|
||||
#? 22 ['mod1']
|
||||
from import_tree.pkg. import mod1
|
||||
#? 17 ['mod1', 'mod2', 'random', 'pkg', 'rename1', 'rename2', 'classes', 'recurse_class1', 'recurse_class2', 'invisible_pkg', 'flow_import']
|
||||
#? 17 ['mod1', 'mod2', 'random', 'pkg', 'rename1', 'rename2', 'classes', 'globals', 'recurse_class1', 'recurse_class2', 'invisible_pkg', 'flow_import']
|
||||
from import_tree. import pkg
|
||||
|
||||
#? 18 ['pkg']
|
||||
|
||||
Reference in New Issue
Block a user