forked from VimPlug/jedi
goto now also returns results for loops without input, fixes #283
This commit is contained in:
+5
-6
@@ -322,6 +322,7 @@ def find_name(scope, name_str, position=None, search_global=False,
|
|||||||
par = name.parent
|
par = name.parent
|
||||||
exc = pr.Class, pr.Function
|
exc = pr.Class, pr.Function
|
||||||
until = lambda: par.parent.parent.get_parent_until(exc)
|
until = lambda: par.parent.parent.get_parent_until(exc)
|
||||||
|
is_array_assignment = False
|
||||||
|
|
||||||
if par is None:
|
if par is None:
|
||||||
pass
|
pass
|
||||||
@@ -367,7 +368,7 @@ def find_name(scope, name_str, position=None, search_global=False,
|
|||||||
if is_exe:
|
if is_exe:
|
||||||
# filter array[3] = ...
|
# filter array[3] = ...
|
||||||
# TODO check executions for dict contents
|
# TODO check executions for dict contents
|
||||||
pass
|
is_array_assignment = True
|
||||||
else:
|
else:
|
||||||
details = par.assignment_details
|
details = par.assignment_details
|
||||||
if details and details[0][1] != '=':
|
if details and details[0][1] != '=':
|
||||||
@@ -384,7 +385,7 @@ def find_name(scope, name_str, position=None, search_global=False,
|
|||||||
if isinstance(par, pr.Import) and len(par.namespace) > 1:
|
if isinstance(par, pr.Import) and len(par.namespace) > 1:
|
||||||
no_break_scope = True
|
no_break_scope = True
|
||||||
result.append(par)
|
result.append(par)
|
||||||
return result, no_break_scope
|
return result, no_break_scope, is_array_assignment
|
||||||
|
|
||||||
flow_scope = scope
|
flow_scope = scope
|
||||||
result = []
|
result = []
|
||||||
@@ -400,11 +401,9 @@ def find_name(scope, name_str, position=None, search_global=False,
|
|||||||
and isinstance(p.var, pr.Class):
|
and isinstance(p.var, pr.Class):
|
||||||
p = p.var
|
p = p.var
|
||||||
if name_str == name.get_code() and p not in break_scopes:
|
if name_str == name.get_code() and p not in break_scopes:
|
||||||
r, no_break_scope = process(name)
|
r, no_break_scope, is_array_assignment = process(name)
|
||||||
if is_goto:
|
if is_goto:
|
||||||
if r:
|
if not is_array_assignment: # shouldn't goto arr[1] =
|
||||||
# Directly assign the name, but there has to be a
|
|
||||||
# result.
|
|
||||||
result.append(name)
|
result.append(name)
|
||||||
else:
|
else:
|
||||||
result += r
|
result += r
|
||||||
|
|||||||
Reference in New Issue
Block a user