mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 23:04:48 +08:00
use scope_names_generator in completion api as well. hopefully the last __file__ related issue :)
This commit is contained in:
@@ -230,7 +230,14 @@ class Script(object):
|
|||||||
continue
|
continue
|
||||||
names = s.get_defined_names(on_import_stmt=True)
|
names = s.get_defined_names(on_import_stmt=True)
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
|
sng = s.scope_names_generator
|
||||||
|
except AttributeError:
|
||||||
names = s.get_defined_names()
|
names = s.get_defined_names()
|
||||||
|
else:
|
||||||
|
names = []
|
||||||
|
for _, new_names in sng():
|
||||||
|
names += new_names
|
||||||
|
|
||||||
for c in names:
|
for c in names:
|
||||||
completions.append((c, s))
|
completions.append((c, s))
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ def scope_basic():
|
|||||||
#? str()
|
#? str()
|
||||||
import_tree.a
|
import_tree.a
|
||||||
|
|
||||||
#? []
|
|
||||||
import_tree.mod1
|
|
||||||
|
|
||||||
def scope_pkg():
|
def scope_pkg():
|
||||||
import import_tree.mod1
|
import import_tree.mod1
|
||||||
@@ -64,7 +62,11 @@ def scope_nested2():
|
|||||||
import_tree.mod1
|
import_tree.mod1
|
||||||
#? ['pkg']
|
#? ['pkg']
|
||||||
import_tree.pkg
|
import_tree.pkg
|
||||||
#? []
|
|
||||||
|
# With the latest changes this completion also works, because submodules
|
||||||
|
# are always included (some nested import structures lead to this,
|
||||||
|
# typically).
|
||||||
|
#? ['rename1']
|
||||||
import_tree.rename1
|
import_tree.rename1
|
||||||
|
|
||||||
def from_names():
|
def from_names():
|
||||||
|
|||||||
Reference in New Issue
Block a user