diff --git a/jedi/parser/user_context.py b/jedi/parser/user_context.py index d3726a20..0dc5edc0 100644 --- a/jedi/parser/user_context.py +++ b/jedi/parser/user_context.py @@ -160,7 +160,8 @@ class UserContext(object): # def/class/import stops the process. if next_must_be_name: if tok_type == tokenize.NAME: - call, _ = self._calc_path_until_cursor(start_pos=pos) + end_pos = start_pos[0], start_pos[1] + len(tok_str) + call, _ = self._calc_path_until_cursor(start_pos=end_pos) return call, index, key_name index = 0 next_must_be_name = False @@ -174,7 +175,6 @@ class UserContext(object): if level == 1: next_must_be_name = True level = 0 - pos = start_pos elif tok_str == ')': level -= 1 elif tok_str == ',': diff --git a/test/test_api/test_call_signatures.py b/test/test_api/test_call_signatures.py index 46c40eac..815d7667 100644 --- a/test/test_api/test_call_signatures.py +++ b/test/test_api/test_call_signatures.py @@ -174,6 +174,9 @@ class TestCallSignatures(TestCase): def test_unterminated_strings(self): self._run('str(";', 'str', 0) + def test_whitespace_before_bracket(self): + self._run('str (";', 'str', 0) + class TestParams(TestCase): def params(self, source, line=None, column=None):