mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 15:24:46 +08:00
flows no longer distort results in certain positions
This commit is contained in:
@@ -829,6 +829,7 @@ def get_names_for_scope(scope, position=None, star_search=True,
|
||||
the whole thing would probably start a little recursive madness.
|
||||
"""
|
||||
start_scope = scope
|
||||
in_scope = scope
|
||||
while scope:
|
||||
# `parsing.Class` is used, because the parent is never `Class`.
|
||||
# Ignore the Flows, because the classes and functions care for that.
|
||||
@@ -840,10 +841,14 @@ def get_names_for_scope(scope, position=None, star_search=True,
|
||||
|
||||
try:
|
||||
yield scope, get_defined_names_for_position(scope, position,
|
||||
start_scope)
|
||||
in_scope)
|
||||
except StopIteration:
|
||||
raise MultiLevelStopIteration('StopIteration raised somewhere')
|
||||
scope = scope.parent
|
||||
# This is used, because subscopes (Flow scopes) would distort the
|
||||
# results.
|
||||
if isinstance(scope, (Function, parsing.Function, Execution)):
|
||||
in_scope = scope
|
||||
|
||||
# Add star imports.
|
||||
if star_search:
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
def find_class():
|
||||
""" This scope is special, because its in front of TestClass """
|
||||
#? ['ret']
|
||||
TestClass.ret
|
||||
if 1:
|
||||
#? ['ret']
|
||||
TestClass.ret
|
||||
|
||||
class FindClass():
|
||||
#? []
|
||||
TestClass.ret
|
||||
if a:
|
||||
#? []
|
||||
TestClass.ret
|
||||
|
||||
def find_class(self):
|
||||
#? ['ret']
|
||||
TestClass.ret
|
||||
if 1:
|
||||
#? ['ret']
|
||||
TestClass.ret
|
||||
|
||||
# set variables, which should not be included, because they don't belong to the
|
||||
# class
|
||||
|
||||
Reference in New Issue
Block a user