diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index 1c9f3074..42b1a43d 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -509,8 +509,8 @@ class Script(object): return [] with common.scale_speed_settings(settings.scale_call_signatures): - origins = cache.cache_call_signatures(self._evaluator, stmt, self.source, - self._pos, stmt) + origins = cache.cache_call_signatures(self._evaluator, stmt, + self.source, self._pos) debug.speed('func_call followed') return [classes.CallSignature(self._evaluator, o.name, stmt, call_index, key_name) diff --git a/jedi/cache.py b/jedi/cache.py index 023f31e0..68a3cc24 100644 --- a/jedi/cache.py +++ b/jedi/cache.py @@ -100,18 +100,18 @@ def time_cache(time_add_setting): @time_cache("call_signatures_validity") -def cache_call_signatures(evaluator, call, source, user_pos, stmt): +def cache_call_signatures(evaluator, call, source, user_pos): """This function calculates the cache key.""" index = user_pos[0] - 1 lines = common.splitlines(source) before_cursor = lines[index][:user_pos[1]] - other_lines = lines[stmt.start_pos[0]:index] + other_lines = lines[call.start_pos[0]:index] whole = '\n'.join(other_lines + [before_cursor]) before_bracket = re.match(r'.*\(', whole, re.DOTALL) - module_path = stmt.get_parent_until().path - yield None if module_path is None else (module_path, before_bracket, stmt.start_pos) + module_path = call.get_parent_until().path + yield None if module_path is None else (module_path, before_bracket, call.start_pos) yield evaluator.eval_element(call)