Simplify getting code for completions.

This commit is contained in:
Dave Halter committed 2017-09-03 00:11:23 +02:00
1 parent fc8326bca1
commit e85816cc85
1 file changed
+1 -7
+1 -7
View File
@@ -93,19 +93,13 @@ def _get_code_for_stack(code_lines, module_node, position):
# Error leafs cannot be parsed, completion in strings is also
# impossible.
raise OnErrorLeaf(leaf)
else:
if leaf == ';':
user_stmt = leaf.parent
else:
user_stmt = leaf
while True:
if user_stmt.parent.type in ('file_input', 'suite'):
if user_stmt.parent.type in ('file_input', 'suite', 'simple_stmt'):
break
user_stmt = user_stmt.parent
if user_stmt.parent.type == 'simple_stmt':
user_stmt = user_stmt.parent
if is_after_newline:
if user_stmt.start_pos[1] > position[1]:
# This means that it's actually a dedent and that means that we