forked from VimPlug/jedi
other random bugfixes for positions and the use of fast_parser
This commit is contained in:
@@ -177,7 +177,7 @@ class Script(object):
|
||||
def _prepare_goto(self, goto_path, is_like_search=False):
|
||||
""" Base for complete, goto and get_definition. Basically it returns
|
||||
the resolved scopes under cursor. """
|
||||
debug.dbg('start: %s in %s' % (goto_path, self.parser.scope))
|
||||
debug.dbg('start: %s in %s' % (goto_path, self.parser.user_scope))
|
||||
|
||||
user_stmt = self.parser.user_stmt
|
||||
debug.speed('parsed')
|
||||
|
||||
@@ -61,6 +61,7 @@ class NoErrorTokenizer(object):
|
||||
self.gen = PushBackIterator(tokenize.generate_tokens(readline))
|
||||
self.line_offset = line_offset
|
||||
self.stop_on_scope = stop_on_scope
|
||||
self.first_scope = False
|
||||
|
||||
def push_last_back(self):
|
||||
self.gen.push_back(self.current)
|
||||
@@ -94,9 +95,13 @@ class NoErrorTokenizer(object):
|
||||
|
||||
# stop if a new class or definition is started at position zero.
|
||||
if self.stop_on_scope and c[1] in ['def', 'class'] and c[2][1] == 0:
|
||||
if self.first_scope:
|
||||
raise StopIteration()
|
||||
else:
|
||||
self.first_scope = True
|
||||
|
||||
c[2] = self.line_offset + c[2][0], c[2][1]
|
||||
c[3] = self.line_offset + c[3][0], c[3][1]
|
||||
return c
|
||||
|
||||
|
||||
|
||||
@@ -252,5 +252,3 @@ def scan_array_for_pos(arr, pos):
|
||||
# The third return is just necessary for recursion inside, because
|
||||
# it needs to know when to stop iterating.
|
||||
return call, check_arr_index(), stop
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user