forked from VimPlug/jedi
don't use function_definition as a name anymore, also not in helper functions
This commit is contained in:
@@ -502,9 +502,9 @@ class Script(object):
|
||||
return []
|
||||
|
||||
user_stmt = self._user_stmt()
|
||||
with common.scale_speed_settings(settings.scale_function_definition):
|
||||
with common.scale_speed_settings(settings.scale_call_signatures):
|
||||
_callable = lambda: evaluate.follow_call(call)
|
||||
origins = cache.cache_function_definition(_callable, user_stmt)
|
||||
origins = cache.cache_call_signatures(_callable, user_stmt)
|
||||
debug.speed('func_call followed')
|
||||
|
||||
return [api_classes.CallDef(o, index, call) for o in origins
|
||||
@@ -516,7 +516,7 @@ class Script(object):
|
||||
if call is None:
|
||||
user_stmt = self._user_stmt()
|
||||
if user_stmt is not None and isinstance(user_stmt, pr.Statement):
|
||||
call, index, _ = helpers.search_function_definition(
|
||||
call, index, _ = helpers.search_call_signatures(
|
||||
user_stmt, self._pos)
|
||||
debug.speed('func_call parsed')
|
||||
return call, index
|
||||
|
||||
@@ -141,8 +141,8 @@ def time_cache(time_add_setting):
|
||||
return _temp
|
||||
|
||||
|
||||
@time_cache("function_definition_validity")
|
||||
def cache_function_definition(stmt):
|
||||
@time_cache("call_signatures_validity")
|
||||
def cache_call_signatures(stmt):
|
||||
module_path = stmt.get_parent_until().path
|
||||
return None if module_path is None else (module_path, stmt.start_pos)
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ def array_for_pos(stmt, pos, array_types=None):
|
||||
return None, 0
|
||||
|
||||
|
||||
def search_function_definition(stmt, pos):
|
||||
def search_call_signatures(stmt, pos):
|
||||
"""
|
||||
Returns the function Call that matches the position before.
|
||||
"""
|
||||
|
||||
@@ -64,14 +64,14 @@ definitely worse in some cases. But a completion should also be fast.
|
||||
.. autodata:: max_function_recursion_level
|
||||
.. autodata:: max_executions_without_builtins
|
||||
.. autodata:: max_executions
|
||||
.. autodata:: scale_function_definition
|
||||
.. autodata:: scale_call_signatures
|
||||
|
||||
|
||||
Caching
|
||||
~~~~~~~
|
||||
|
||||
.. autodata:: star_import_cache_validity
|
||||
.. autodata:: function_definition_validity
|
||||
.. autodata:: call_signatures_validity
|
||||
|
||||
|
||||
"""
|
||||
@@ -211,9 +211,9 @@ max_executions = 250
|
||||
A maximum amount of time, the completion may use.
|
||||
"""
|
||||
|
||||
scale_function_definition = 0.1
|
||||
scale_call_signatures = 0.1
|
||||
"""
|
||||
Because function_definition is normally used on every single key hit, it has
|
||||
Because call_signatures is normally used on every single key hit, it has
|
||||
to be faster than a normal completion. This is the factor that is used to
|
||||
scale `max_executions` and `max_until_execution_unique`:
|
||||
"""
|
||||
@@ -229,7 +229,7 @@ might be slow, therefore we do a star import caching, that lasts a certain
|
||||
time span (in seconds).
|
||||
"""
|
||||
|
||||
function_definition_validity = 3.0
|
||||
call_signatures_validity = 3.0
|
||||
"""
|
||||
Finding function calls might be slow (0.1-0.5s). This is not acceptible for
|
||||
normal writing. Therefore cache it for a short time.
|
||||
|
||||
Reference in New Issue
Block a user