forked from VimPlug/jedi
Completion now always takes a NamePart as input.
This commit is contained in:
@@ -29,6 +29,7 @@ from jedi.common import source_to_unicode
|
||||
from jedi.evaluate import compiled
|
||||
from jedi.evaluate import analysis
|
||||
from jedi.evaluate.cache import memoize_default, NO_DEFAULT
|
||||
from jedi.evaluate.helpers import FakeSubModule
|
||||
|
||||
|
||||
class ModuleNotFound(Exception):
|
||||
@@ -368,12 +369,12 @@ class _Importer(object):
|
||||
pos = (part._line, part._column)
|
||||
try:
|
||||
self.import_path = (
|
||||
pr.NamePart('flask_' + str(part), part.parent, pos),
|
||||
pr.NamePart(FakeSubModule, 'flask_' + str(part), part.parent, pos),
|
||||
) + orig_path[3:]
|
||||
return self._real_follow_file_system()
|
||||
except ModuleNotFound as e:
|
||||
self.import_path = (
|
||||
pr.NamePart('flaskext', part.parent, pos),
|
||||
pr.NamePart(FakeSubModule, 'flaskext', part.parent, pos),
|
||||
) + orig_path[2:]
|
||||
return self._real_follow_file_system()
|
||||
return self._real_follow_file_system()
|
||||
|
||||
@@ -237,7 +237,8 @@ class ArrayMethod(IterableWrapper):
|
||||
@property
|
||||
@underscore_memoization
|
||||
def names(self):
|
||||
return [pr.NamePart(unicode(n), self, n.start_pos) for n in self.name.names]
|
||||
# TODO remove this method, we need the ArrayMethod input to be a NamePart.
|
||||
return [pr.NamePart(self.name._sub_module, unicode(n), self, n.start_pos) for n in self.name.names]
|
||||
|
||||
def __getattr__(self, name):
|
||||
# Set access privileges:
|
||||
|
||||
@@ -294,7 +294,8 @@ class InstanceElement(use_metaclass(CachedMetaClass, pr.Base)):
|
||||
@property
|
||||
@underscore_memoization
|
||||
def names(self):
|
||||
return [pr.NamePart(unicode(n), self, n.start_pos) for n in self.var.names]
|
||||
return [pr.NamePart(helpers.FakeSubModule, unicode(n), self, n.start_pos)
|
||||
for n in self.var.names]
|
||||
|
||||
@property
|
||||
@underscore_memoization
|
||||
|
||||
Reference in New Issue
Block a user