mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-10 15:51:51 +08:00
completion wasn't working properly on the first line, thx to @gwrtheyrn for testing
This commit is contained in:
@@ -96,7 +96,6 @@ class ModuleWithCursor(Module):
|
|||||||
if token_type == tokenize.NUMBER and tok[0] == '.':
|
if token_type == tokenize.NUMBER and tok[0] == '.':
|
||||||
force_point = False
|
force_point = False
|
||||||
else:
|
else:
|
||||||
#print 'break2', token_type, tok
|
|
||||||
break
|
break
|
||||||
elif tok in close_brackets:
|
elif tok in close_brackets:
|
||||||
level += 1
|
level += 1
|
||||||
@@ -105,7 +104,6 @@ class ModuleWithCursor(Module):
|
|||||||
elif token_type == tokenize.NUMBER:
|
elif token_type == tokenize.NUMBER:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
#print 'break', token_type, tok
|
|
||||||
break
|
break
|
||||||
|
|
||||||
string += tok
|
string += tok
|
||||||
@@ -127,7 +125,11 @@ class ModuleWithCursor(Module):
|
|||||||
if not self._line_cache:
|
if not self._line_cache:
|
||||||
self._line_cache = self.source.split('\n')
|
self._line_cache = self.source.split('\n')
|
||||||
|
|
||||||
if line < 1:
|
if line == 0:
|
||||||
|
# This is a fix for the zeroth line. We need a newline there, for
|
||||||
|
# the backwards parser.
|
||||||
|
return ''
|
||||||
|
if line < 0:
|
||||||
raise StopIteration()
|
raise StopIteration()
|
||||||
try:
|
try:
|
||||||
return self._line_cache[line - 1]
|
return self._line_cache[line - 1]
|
||||||
|
|||||||
Reference in New Issue
Block a user