From 1d2debf38d7a6eb6a607f824fafb016f39ef2c9d Mon Sep 17 00:00:00 2001 From: David Halter Date: Tue, 16 Oct 2012 10:07:12 +0200 Subject: [PATCH] fixes jedi-vim issue 9 - parser error in with statement --- jedi/parsing.py | 3 ++- test/regression.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/jedi/parsing.py b/jedi/parsing.py index 6d38485f..b34185c7 100644 --- a/jedi/parsing.py +++ b/jedi/parsing.py @@ -1702,7 +1702,8 @@ class PyFuzzyParser(object): # multiple statements because of with inits = [] first = True - while first or command == 'with' and tok != ':': + while first or command == 'with' \ + and tok not in [':', '\n']: statement, tok = \ self._parse_statement(added_breaks=added_breaks) if command == 'except' and tok in added_breaks: diff --git a/test/regression.py b/test/regression.py index 1790f399..def39e81 100755 --- a/test/regression.py +++ b/test/regression.py @@ -161,6 +161,10 @@ class TestRegression(unittest.TestCase): s = "import time; abc = time; abc.sleep(" assert check(self.get_in_function_call(s), 'sleep', 0) + # jedi-vim #9 + s = "with open(" + assert check(self.get_in_function_call(s), 'open', 0) + def test_add_dynamic_mods(self): api.settings.additional_dynamic_modules = ['dynamic.py'] # Fictional module that defines a function.