mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-10 07:41:51 +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()
|
||||
context = self._user_context.get_context()
|
||||
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)
|
||||
if stmt is None:
|
||||
return []
|
||||
|
||||
if user_stmt is None:
|
||||
if user_scope is None:
|
||||
last_name = None
|
||||
else:
|
||||
# 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:
|
||||
last_name = stmt
|
||||
|
||||
@@ -484,7 +484,7 @@ class Evaluator(object):
|
||||
self.find_types(typ, name, is_goto=True) for typ in types
|
||||
))
|
||||
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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user