mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-16 10:37:52 +08:00
goto should always goto definitions, fixes #1304
This commit is contained in:
@@ -318,11 +318,11 @@ class Evaluator(object):
|
|||||||
return [TreeNameDefinition(context, name)]
|
return [TreeNameDefinition(context, name)]
|
||||||
elif type_ == 'param':
|
elif type_ == 'param':
|
||||||
return [ParamName(context, name)]
|
return [ParamName(context, name)]
|
||||||
elif type_ in ('funcdef', 'classdef'):
|
|
||||||
return [TreeNameDefinition(context, name)]
|
|
||||||
elif type_ in ('import_from', 'import_name'):
|
elif type_ in ('import_from', 'import_name'):
|
||||||
module_names = imports.infer_import(context, name, is_goto=True)
|
module_names = imports.infer_import(context, name, is_goto=True)
|
||||||
return module_names
|
return module_names
|
||||||
|
else:
|
||||||
|
return [TreeNameDefinition(context, name)]
|
||||||
else:
|
else:
|
||||||
contexts = self._follow_error_node_imports_if_possible(context, name)
|
contexts = self._follow_error_node_imports_if_possible(context, name)
|
||||||
if contexts is not None:
|
if contexts is not None:
|
||||||
|
|||||||
@@ -203,9 +203,10 @@ for key, value in [(1,2)]:
|
|||||||
#! ['for key, value in [(1,2)]: key']
|
#! ['for key, value in [(1,2)]: key']
|
||||||
key
|
key
|
||||||
|
|
||||||
for i in []:
|
#! 4 ['for y in [1]: y']
|
||||||
#! ['for i in []: i']
|
for y in [1]:
|
||||||
i
|
#! ['for y in [1]: y']
|
||||||
|
y
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# decorator
|
# decorator
|
||||||
|
|||||||
Reference in New Issue
Block a user