forked from VimPlug/jedi
Remove param from get_statement_for_position.
This commit is contained in:
@@ -682,9 +682,6 @@ class FunctionExecution(Executed):
|
|||||||
def subscopes(self):
|
def subscopes(self):
|
||||||
return self._copy_list(self.base.subscopes)
|
return self._copy_list(self.base.subscopes)
|
||||||
|
|
||||||
def get_statement_for_position(self, pos):
|
|
||||||
return pr.Scope.get_statement_for_position(self, pos)
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<%s of %s>" % (type(self).__name__, self.base)
|
return "<%s of %s>" % (type(self).__name__, self.base)
|
||||||
|
|
||||||
|
|||||||
@@ -552,10 +552,8 @@ class Scope(Simple, DocstringMixin):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
@Python3Method
|
@Python3Method
|
||||||
def get_statement_for_position(self, pos, include_imports=False):
|
def get_statement_for_position(self, pos):
|
||||||
checks = self.statements + self.asserts
|
checks = self.statements + self.asserts + self.imports
|
||||||
if include_imports:
|
|
||||||
checks += self.imports
|
|
||||||
if self.isinstance(Function):
|
if self.isinstance(Function):
|
||||||
checks += self.get_decorators()
|
checks += self.get_decorators()
|
||||||
checks += [r for r in self.returns if r is not None]
|
checks += [r for r in self.returns if r is not None]
|
||||||
@@ -566,7 +564,7 @@ class Scope(Simple, DocstringMixin):
|
|||||||
|
|
||||||
for s in self.subscopes:
|
for s in self.subscopes:
|
||||||
if s.start_pos <= pos <= s.end_pos:
|
if s.start_pos <= pos <= s.end_pos:
|
||||||
p = s.get_statement_for_position(pos, include_imports)
|
p = s.get_statement_for_position(pos)
|
||||||
if p:
|
if p:
|
||||||
return p
|
return p
|
||||||
|
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ class UserContextParser(object):
|
|||||||
def user_stmt(self):
|
def user_stmt(self):
|
||||||
module = self.module()
|
module = self.module()
|
||||||
debug.speed('parsed')
|
debug.speed('parsed')
|
||||||
return module.get_statement_for_position(self._position, include_imports=True)
|
return module.get_statement_for_position(self._position)
|
||||||
|
|
||||||
@cache.underscore_memoization
|
@cache.underscore_memoization
|
||||||
def user_stmt_with_whitespace(self):
|
def user_stmt_with_whitespace(self):
|
||||||
@@ -278,7 +278,7 @@ class UserContextParser(object):
|
|||||||
debug.warning('No statement under the cursor.')
|
debug.warning('No statement under the cursor.')
|
||||||
return
|
return
|
||||||
pos = next(self._user_context.get_context(yield_positions=True))
|
pos = next(self._user_context.get_context(yield_positions=True))
|
||||||
user_stmt = self.module().get_statement_for_position(pos, include_imports=True)
|
user_stmt = self.module().get_statement_for_position(pos)
|
||||||
return user_stmt
|
return user_stmt
|
||||||
|
|
||||||
@cache.underscore_memoization
|
@cache.underscore_memoization
|
||||||
|
|||||||
Reference in New Issue
Block a user