From e85816cc8540f75e0c34eb18021a8a2f7b641a87 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sun, 3 Sep 2017 00:11:23 +0200 Subject: [PATCH] Simplify getting code for completions. --- jedi/api/helpers.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/jedi/api/helpers.py b/jedi/api/helpers.py index e1e9e8a6..4968a23a 100644 --- a/jedi/api/helpers.py +++ b/jedi/api/helpers.py @@ -94,16 +94,10 @@ def _get_code_for_stack(code_lines, module_node, position): # 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'): - break - user_stmt = user_stmt.parent - - if user_stmt.parent.type == 'simple_stmt': + user_stmt = leaf + while True: + if user_stmt.parent.type in ('file_input', 'suite', 'simple_stmt'): + break user_stmt = user_stmt.parent if is_after_newline: