mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 14:54:47 +08:00
Fix: Nested flows user scope detection was wrong.
This commit is contained in:
@@ -301,7 +301,7 @@ class Script(object):
|
|||||||
return []
|
return []
|
||||||
scopes = [i]
|
scopes = [i]
|
||||||
else:
|
else:
|
||||||
# just parse one statement, take it and evaluate it
|
# Just parse one statement, take it and evaluate it.
|
||||||
eval_stmt = self._get_under_cursor_stmt(goto_path)
|
eval_stmt = self._get_under_cursor_stmt(goto_path)
|
||||||
if eval_stmt is None:
|
if eval_stmt is None:
|
||||||
return []
|
return []
|
||||||
|
|||||||
@@ -325,11 +325,10 @@ class UserContextParser(object):
|
|||||||
for s in scope.children:
|
for s in scope.children:
|
||||||
if s.start_pos <= self._position <= s.end_pos:
|
if s.start_pos <= self._position <= s.end_pos:
|
||||||
if isinstance(s, (tree.Scope, tree.Flow)):
|
if isinstance(s, (tree.Scope, tree.Flow)):
|
||||||
if isinstance(s, tree.Flow):
|
return scan(s) or s
|
||||||
return s
|
|
||||||
return scan(s) or s
|
|
||||||
elif s.type in ('suite', 'decorated'):
|
elif s.type in ('suite', 'decorated'):
|
||||||
return scan(s)
|
return scan(s)
|
||||||
|
return None
|
||||||
|
|
||||||
return scan(self.module()) or self.module()
|
return scan(self.module()) or self.module()
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user