diff --git a/jedi/inference/gradual/annotation.py b/jedi/inference/gradual/annotation.py index 81780010..57098276 100644 --- a/jedi/inference/gradual/annotation.py +++ b/jedi/inference/gradual/annotation.py @@ -402,6 +402,10 @@ def find_type_from_comment_hint_for(context, node, name): def find_type_from_comment_hint_with(context, node, name): + if len(node.children) > 4: + # In case there are multiple with_items, we do not want a type hint for + # now. + return [] assert len(node.children[1].children) == 3, \ "Can only be here when children[1] is 'foo() as f'" varlist = node.children[1].children[2] diff --git a/test/completion/basic.py b/test/completion/basic.py index 97bfeecd..53df851e 100644 --- a/test/completion/basic.py +++ b/test/completion/basic.py @@ -413,6 +413,10 @@ with Foo() as f3: with Foo() as f3: f3 +with open("a"), open("b") as bfile: + #? ['flush'] + bfile.flush + # ----------------- # Avoiding multiple definitions # -----------------