mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-24 17:28:36 +08:00
Simplify getting code for completions.
This commit is contained in:
+4
-10
@@ -94,16 +94,10 @@ def _get_code_for_stack(code_lines, module_node, position):
|
|||||||
# impossible.
|
# impossible.
|
||||||
raise OnErrorLeaf(leaf)
|
raise OnErrorLeaf(leaf)
|
||||||
else:
|
else:
|
||||||
if leaf == ';':
|
user_stmt = leaf
|
||||||
user_stmt = leaf.parent
|
while True:
|
||||||
else:
|
if user_stmt.parent.type in ('file_input', 'suite', 'simple_stmt'):
|
||||||
user_stmt = leaf
|
break
|
||||||
while True:
|
|
||||||
if user_stmt.parent.type in ('file_input', 'suite'):
|
|
||||||
break
|
|
||||||
user_stmt = user_stmt.parent
|
|
||||||
|
|
||||||
if user_stmt.parent.type == 'simple_stmt':
|
|
||||||
user_stmt = user_stmt.parent
|
user_stmt = user_stmt.parent
|
||||||
|
|
||||||
if is_after_newline:
|
if is_after_newline:
|
||||||
|
|||||||
Reference in New Issue
Block a user