diff --git a/jedi/api.py b/jedi/api.py index 1ed57f6b..98c5f2ec 100644 --- a/jedi/api.py +++ b/jedi/api.py @@ -416,49 +416,13 @@ class Script(object): return api_classes.CallDef(executable, index, call) def _func_call_and_param_index(self): - def check_user_stmt(user_stmt): - if user_stmt is None \ - or not isinstance(user_stmt, pr.Statement): - return None, 0 - - call, index, stop = helpers.search_function_definition(user_stmt, self.pos) - return call, index - - def check_cache(): - """ Do the parsing with a part parser, therefore reduce ressource - costs. - TODO this is not working with multi-line docstrings, improve. - """ - if self.source_path is None: - return None, 0 - - try: - parser = cache.parser_cache[self.source_path].parser - except KeyError: - return None, 0 - part_parser = self._module.get_part_parser() - user_stmt = part_parser.user_stmt - call, index = check_user_stmt(user_stmt) - if call: - old_stmt = parser.module.get_statement_for_position(self.pos) - if old_stmt is None: - return None, 0 - old_call, old_index = check_user_stmt(old_stmt) - if old_call: - # compare repr because that should definitely be the same. - # Otherwise the whole thing is out of sync. - if repr(old_call) == repr(call): - # return the index of the part_parser - return old_call, index - return None, 0 - debug.speed('func_call start') - call = None - index = 0 - if settings.use_function_definition_cache: - call, index = check_cache() + call, index = None, 0 if call is None: - call, index = check_user_stmt(self._parser.user_stmt) + user_stmt = self._parser.user_stmt + if user_stmt is not None and isinstance(user_stmt, pr.Statement): + call, index, _ = helpers.search_function_definition( + user_stmt, self.pos) debug.speed('func_call parsed') return call, index diff --git a/jedi/modules.py b/jedi/modules.py index 398bcf69..37e5bbac 100644 --- a/jedi/modules.py +++ b/jedi/modules.py @@ -23,11 +23,9 @@ from ast import literal_eval from jedi._compatibility import exec_function, unicode from jedi import cache -from jedi import parsing from jedi import parsing_representation as pr from jedi import fast_parser from jedi import debug -from jedi import settings from jedi import common @@ -103,7 +101,6 @@ class ModuleWithCursor(Module): self._relevant_temp = None self.source = source - self._part_parser = None @property def parser(self): @@ -251,21 +248,6 @@ class ModuleWithCursor(Module): except IndexError: raise StopIteration() - def get_part_parser(self): - """ Returns a parser that contains only part of the source code. This - exists only because of performance reasons. - """ - if self._part_parser: - return self._part_parser - - # TODO check for docstrings - length = settings.part_line_length - offset = max(self.position[0] - length, 0) - s = '\n'.join(self.source.splitlines()[offset:offset + length]) - self._part_parser = parsing.Parser(s, self.path, self.position, - offset=(offset, 0)) - return self._part_parser - def get_sys_path(): def check_virtual_env(sys_path): diff --git a/jedi/settings.py b/jedi/settings.py index df48e7ac..e95940fd 100644 --- a/jedi/settings.py +++ b/jedi/settings.py @@ -33,7 +33,6 @@ Parser ~~~~~~ .. autodata:: fast_parser -.. autodata:: use_function_definition_cache Dynamic stuff @@ -149,13 +148,6 @@ something has been changed e.g. to a function. If this happens, only the function is being reparsed. """ -use_function_definition_cache = True -""" -Use the cache (full cache) to generate function_definition's. This may fail -with multiline docstrings (likely) and other complicated changes (unlikely). -The goal is to move away from it by making the rest faster. -""" - # ---------------- # dynamic stuff # ----------------