forked from VimPlug/jedi
Apply evaluate.representation wrappers already before they go out into the goto world.
This commit is contained in:
@@ -186,6 +186,10 @@ class Script(object):
|
||||
and n.lower().startswith(like.lower()) \
|
||||
or n.startswith(like):
|
||||
if not filter_private_variable(s, user_stmt or self._parser.user_scope(), n):
|
||||
if isinstance(c.parent.parent, (pr.Function, pr.Class)):
|
||||
# TODO I think this is a hack. It should be an
|
||||
# er.Function/er.Class before that.
|
||||
c = er.wrap(self._evaluator, c.parent.parent).name.names[-1]
|
||||
new = classes.Completion(self._evaluator, c, needs_dot, len(like), s)
|
||||
k = (new.name, new.complete) # key
|
||||
if k in comp_dct and settings.no_completion_duplicates:
|
||||
@@ -378,7 +382,7 @@ class Script(object):
|
||||
context = self._user_context.get_context()
|
||||
definitions = set()
|
||||
if next(context) in ('class', 'def'):
|
||||
definitions = set([self._parser.user_scope()])
|
||||
definitions = set([er.wrap(self._evaluator, self._parser.user_scope())])
|
||||
else:
|
||||
# Fetch definition of callee, if there's no path otherwise.
|
||||
if not goto_path:
|
||||
|
||||
@@ -344,20 +344,12 @@ class BaseDefinition(object):
|
||||
"""
|
||||
Follow both statements and imports, as far as possible.
|
||||
"""
|
||||
stripped = self._definition
|
||||
|
||||
# We should probably work in `Finder._names_to_types` here.
|
||||
if isinstance(stripped, pr.Function):
|
||||
stripped = er.Function(self._evaluator, stripped)
|
||||
elif isinstance(stripped, pr.Class):
|
||||
stripped = er.Class(self._evaluator, stripped)
|
||||
|
||||
if stripped.isinstance(pr.ExprStmt):
|
||||
return self._evaluator.eval_statement(stripped)
|
||||
elif stripped.isinstance(pr.Import):
|
||||
return imports.follow_imports(self._evaluator, [stripped])
|
||||
if self._definition.isinstance(pr.ExprStmt):
|
||||
return self._evaluator.eval_statement(self._definition)
|
||||
elif self._definition.isinstance(pr.Import):
|
||||
return imports.follow_imports(self._evaluator, [self._definition])
|
||||
else:
|
||||
return [stripped]
|
||||
return [self._definition]
|
||||
|
||||
@property
|
||||
@memoize_default()
|
||||
|
||||
Reference in New Issue
Block a user