forked from VimPlug/jedi
More goto improvements.
This commit is contained in:
@@ -590,16 +590,18 @@ class Definition(use_metaclass(CachedMetaClass, BaseDefinition)):
|
|||||||
elif isinstance(d, pr.Module):
|
elif isinstance(d, pr.Module):
|
||||||
# only show module name
|
# only show module name
|
||||||
d = 'module %s' % self.module_name
|
d = 'module %s' % self.module_name
|
||||||
else:
|
elif isinstance(d, pr.Param):
|
||||||
|
d = d.get_code()
|
||||||
|
else: # ExprStmt
|
||||||
first_leaf = d.first_leaf()
|
first_leaf = d.first_leaf()
|
||||||
# Remove the prefix, because that's not what we want for get_code
|
# Remove the prefix, because that's not what we want for get_code
|
||||||
# here.
|
# here.
|
||||||
old, first_leaf.prefix = first_leaf.prefix, ''
|
old, first_leaf.prefix = first_leaf.prefix, ''
|
||||||
try:
|
try:
|
||||||
d = d.get_code().replace('\n', '').replace('\r', '')
|
d = d.get_code()
|
||||||
finally:
|
finally:
|
||||||
first_leaf.prefix = old
|
first_leaf.prefix = old
|
||||||
return d
|
return d.replace('\n', '').replace('\r', '')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def desc_with_module(self):
|
def desc_with_module(self):
|
||||||
|
|||||||
@@ -454,7 +454,8 @@ class Evaluator(object):
|
|||||||
return iterable.unite(self.find_types(typ, name, is_goto=True)
|
return iterable.unite(self.find_types(typ, name, is_goto=True)
|
||||||
for typ in types)
|
for typ in types)
|
||||||
else:
|
else:
|
||||||
return self.find_types(scope, name, search_global=True, is_goto=True)
|
return self.find_types(scope, name, name.start_pos,
|
||||||
|
search_global=True, is_goto=True)
|
||||||
if isinstance(stmt, pr.Import):
|
if isinstance(stmt, pr.Import):
|
||||||
# Nowhere to goto for aliases
|
# Nowhere to goto for aliases
|
||||||
if stmt.alias == call_path[0]:
|
if stmt.alias == call_path[0]:
|
||||||
|
|||||||
@@ -1469,6 +1469,9 @@ class Param(Base):
|
|||||||
def parent_function(self):
|
def parent_function(self):
|
||||||
return self.get_parent_until(IsScope)
|
return self.get_parent_until(IsScope)
|
||||||
|
|
||||||
|
def get_code(self):
|
||||||
|
return self.tfpdef.get_code()
|
||||||
|
|
||||||
def __init__old(self):
|
def __init__old(self):
|
||||||
kwargs.pop('names_are_set_vars', None)
|
kwargs.pop('names_are_set_vars', None)
|
||||||
super(Param, self).__init__(*args, names_are_set_vars=True, **kwargs)
|
super(Param, self).__init__(*args, names_are_set_vars=True, **kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user