forked from VimPlug/jedi
Refactor user scope search.
This commit is contained in:
@@ -289,12 +289,14 @@ class UserContextParser(object):
|
|||||||
user_stmt = self.user_stmt()
|
user_stmt = self.user_stmt()
|
||||||
if user_stmt is None:
|
if user_stmt is None:
|
||||||
def scan(scope):
|
def scan(scope):
|
||||||
for s in scope.subscopes + list(reversed(scope.flows)):
|
for s in scope.children:
|
||||||
if isinstance(s, (pr.Scope, pr.Flow)):
|
if s.start_pos <= self._position <= s.end_pos:
|
||||||
if s.start_pos <= self._position <= s.end_pos:
|
if isinstance(s, (pr.Scope, pr.Flow)):
|
||||||
if isinstance(s, pr.Flow):
|
if isinstance(s, pr.Flow):
|
||||||
return s
|
return s
|
||||||
return scan(s) or s
|
return scan(s) or s
|
||||||
|
elif s.type in ('suite', 'decorated'):
|
||||||
|
return scan(s)
|
||||||
|
|
||||||
return scan(self.module()) or self.module()
|
return scan(self.module()) or self.module()
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user