forked from VimPlug/jedi
Temporarily disable on import completion. Not sure if we're going to do it with the normal parser.
This commit is contained in:
@@ -226,9 +226,12 @@ class Script(object):
|
||||
current_line = self._user_context.get_position_line()
|
||||
if not current_line.endswith('import import'):
|
||||
continue
|
||||
"""
|
||||
a = s.import_stmt.alias
|
||||
if a and a.start_pos <= self._pos <= a.end_pos:
|
||||
continue
|
||||
"""
|
||||
# TODO what to do with this?
|
||||
names = s.get_defined_names(on_import_stmt=True)
|
||||
else:
|
||||
names = []
|
||||
|
||||
@@ -25,7 +25,7 @@ def get_on_import_stmt(evaluator, user_context, user_stmt, is_like_search=False)
|
||||
Resolve the user statement, if it is an import. Only resolve the
|
||||
parts until the user position.
|
||||
"""
|
||||
name = user_stmt.leaf_for_position(user_context.position)
|
||||
name = user_stmt.name_for_position(user_context.position)
|
||||
if name is None:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class ModuleNotFound(Exception):
|
||||
self.name_part = name_part
|
||||
|
||||
|
||||
class ImportWrapper():
|
||||
class ImportWrapper(pr.Base):
|
||||
GlobalNamespace = 'TODO PLEASE DELETE ME'
|
||||
def __init__(self, evaluator, name):
|
||||
self._evaluator = evaluator
|
||||
@@ -48,6 +48,10 @@ class ImportWrapper():
|
||||
self.import_path = self._import.path_for_name(name)
|
||||
self.is_like_search = False # TODO REMOVE
|
||||
|
||||
def get_defined_names(self, on_import_stmt=False):
|
||||
# TODO not sure if this method is actually necessary.
|
||||
return []
|
||||
|
||||
@memoize_default()
|
||||
def follow(self, is_goto=False):
|
||||
if self._evaluator.recursion_detector.push_stmt(self._import):
|
||||
|
||||
@@ -414,13 +414,13 @@ class Simple(Base):
|
||||
def get_code(self):
|
||||
return "".join(c.get_code() for c in self.children)
|
||||
|
||||
def leaf_for_position(self, position):
|
||||
def name_for_position(self, position):
|
||||
for c in self.children:
|
||||
if isinstance(c, Leaf):
|
||||
if c.start_pos <= position < c.end_pos:
|
||||
if c.start_pos <= position <= c.end_pos:
|
||||
return c
|
||||
else:
|
||||
result = c.leaf_for_position(position)
|
||||
result = c.name_for_position(position)
|
||||
if result is not None:
|
||||
return result
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user