forked from VimPlug/jedi
Reenable star import caching.
This commit is contained in:
@@ -145,7 +145,7 @@ class Script(object):
|
||||
# TODO this paragraph is necessary, but not sure it works.
|
||||
context = self._user_context.get_context()
|
||||
|
||||
print(next(self._user_context.get_context()), 'x')
|
||||
# print(next(self._user_context.get_context()), 'x')
|
||||
if not next(context).startswith('.'): # skip the path
|
||||
if next(context) == 'from':
|
||||
# completion is just "import" if before stands from ..
|
||||
|
||||
@@ -166,9 +166,9 @@ def memoize(func):
|
||||
|
||||
def cache_star_import(func):
|
||||
@time_cache("star_import_cache_validity")
|
||||
def wrapper(evaluator, scope, *args, **kwargs):
|
||||
yield scope # The cache key
|
||||
yield func(evaluator, scope, *args, **kwargs)
|
||||
def wrapper(self):
|
||||
yield self.base # The cache key
|
||||
yield func(self)
|
||||
return wrapper
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ def completion_names(evaluator, imp, pos):
|
||||
if node.end_pos <= pos:
|
||||
if node in ('.', '...'):
|
||||
level += len(node.value)
|
||||
print(node, level)
|
||||
import_path = []
|
||||
else:
|
||||
# Completion on an existing name.
|
||||
@@ -127,7 +126,6 @@ class ImportWrapper(pr.Base):
|
||||
self._evaluator.find_types(s, rest[0], is_goto=True)
|
||||
for s in scopes))
|
||||
else:
|
||||
print(self._import, scopes, rest)
|
||||
if self._import.type == 'import_from' \
|
||||
or importer.str_import_path == ('os', 'path'):
|
||||
scopes = importer.follow_rest(scopes[0], rest)
|
||||
|
||||
@@ -36,7 +36,7 @@ from jedi._compatibility import use_metaclass, unicode, Python3Method
|
||||
from jedi.parser import tree as pr
|
||||
from jedi import debug
|
||||
from jedi import common
|
||||
from jedi.cache import underscore_memoization
|
||||
from jedi.cache import underscore_memoization, cache_star_import
|
||||
from jedi.evaluate.cache import memoize_default, CachedMetaClass, NO_DEFAULT
|
||||
from jedi.evaluate import compiled
|
||||
from jedi.evaluate import recursion
|
||||
@@ -754,6 +754,7 @@ class ModuleWrapper(use_metaclass(CachedMetaClass, pr.Module, Wrapper)):
|
||||
if sub_modules:
|
||||
yield self, self._sub_modules()
|
||||
|
||||
@cache_star_import
|
||||
@memoize_default([])
|
||||
def star_imports(self):
|
||||
modules = []
|
||||
|
||||
Reference in New Issue
Block a user