mirror of
https://github.com/davidhalter/jedi.git
synced 2026-09-05 04:06:57 +08:00
Simplify getting code for completions.
This commit is contained in:
+1
-7
@@ -93,19 +93,13 @@ def _get_code_for_stack(code_lines, module_node, position):
|
|||||||
# Error leafs cannot be parsed, completion in strings is also
|
# Error leafs cannot be parsed, completion in strings is also
|
||||||
# impossible.
|
# impossible.
|
||||||
raise OnErrorLeaf(leaf)
|
raise OnErrorLeaf(leaf)
|
||||||
else:
|
|
||||||
if leaf == ';':
|
|
||||||
user_stmt = leaf.parent
|
|
||||||
else:
|
else:
|
||||||
user_stmt = leaf
|
user_stmt = leaf
|
||||||
while True:
|
while True:
|
||||||
if user_stmt.parent.type in ('file_input', 'suite'):
|
if user_stmt.parent.type in ('file_input', 'suite', 'simple_stmt'):
|
||||||
break
|
break
|
||||||
user_stmt = user_stmt.parent
|
user_stmt = user_stmt.parent
|
||||||
|
|
||||||
if user_stmt.parent.type == 'simple_stmt':
|
|
||||||
user_stmt = user_stmt.parent
|
|
||||||
|
|
||||||
if is_after_newline:
|
if is_after_newline:
|
||||||
if user_stmt.start_pos[1] > position[1]:
|
if user_stmt.start_pos[1] > position[1]:
|
||||||
# This means that it's actually a dedent and that means that we
|
# This means that it's actually a dedent and that means that we
|
||||||
|
|||||||
Reference in New Issue
Block a user