diff --git a/jedi/parser_utils.py b/jedi/parser_utils.py index 4ceced5c..bb033ed0 100644 --- a/jedi/parser_utils.py +++ b/jedi/parser_utils.py @@ -88,10 +88,12 @@ def get_flow_branch_keyword(flow_node, node): keyword = first_leaf return 0 + def get_statement_of_position(node, pos): for c in node.children: if c.start_pos <= pos <= c.end_pos: - if c.type not in ('decorated', 'simple_stmt', 'suite') \ + if c.type not in ('decorated', 'simple_stmt', 'suite', + 'async_stmt', 'async_funcdef') \ and not isinstance(c, (tree.Flow, tree.ClassOrFunc)): return c else: diff --git a/test/completion/async_.py b/test/completion/async_.py index a5484173..2af7fdda 100644 --- a/test/completion/async_.py +++ b/test/completion/async_.py @@ -73,3 +73,12 @@ async def wrapper(): asgen().__ane #? [] asgen().mro + + +# Normal completion (#1092) +normal_var1 = 42 + +async def foo(): + normal_var2 = False + #? ['normal_var1', 'normal_var2'] + normal_var