mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
Goto fixes.
This commit is contained in:
@@ -471,16 +471,18 @@ class Script(object):
|
|||||||
goto_path = self._user_context.get_path_under_cursor()
|
goto_path = self._user_context.get_path_under_cursor()
|
||||||
context = self._user_context.get_context()
|
context = self._user_context.get_context()
|
||||||
user_stmt = self._parser.user_stmt()
|
user_stmt = self._parser.user_stmt()
|
||||||
|
user_scope = self._parser.user_scope()
|
||||||
|
|
||||||
|
# TODO restructure this. stmt is not always needed.
|
||||||
stmt = self._get_under_cursor_stmt(goto_path)
|
stmt = self._get_under_cursor_stmt(goto_path)
|
||||||
if stmt is None:
|
if stmt is None:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
if user_stmt is None:
|
if user_scope is None:
|
||||||
last_name = None
|
last_name = None
|
||||||
else:
|
else:
|
||||||
# Try to use the parser if possible.
|
# Try to use the parser if possible.
|
||||||
last_name = user_stmt.name_for_position(self._pos)
|
last_name = user_scope.name_for_position(self._pos)
|
||||||
|
|
||||||
if last_name is None:
|
if last_name is None:
|
||||||
last_name = stmt
|
last_name = stmt
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ class Evaluator(object):
|
|||||||
self.find_types(typ, name, is_goto=True) for typ in types
|
self.find_types(typ, name, is_goto=True) for typ in types
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
return self.find_types(scope, name, name.start_pos,
|
return self.find_types(scope, name, stmt.start_pos,
|
||||||
search_global=True, is_goto=True)
|
search_global=True, is_goto=True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ for i in range(1):
|
|||||||
i
|
i
|
||||||
|
|
||||||
for key, value in [(1,2)]:
|
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 []:
|
for i in []:
|
||||||
|
|||||||
Reference in New Issue
Block a user