1
0
forked from VimPlug/jedi

Fix call signatures, use stubs if possible

This commit is contained in:
Dave Halter
2019-05-11 12:44:20 +02:00
parent 079783e3a1
commit 8b1d4a7824
3 changed files with 11 additions and 5 deletions

View File

@@ -136,11 +136,14 @@ def get_stack_at_position(grammar, code_lines, module_node, pos):
)
def evaluate_goto_definition(evaluator, context, leaf):
def evaluate_goto_definition(evaluator, context, leaf, prefer_stubs=False):
if leaf.type == 'name':
# In case of a name we can just use goto_definition which does all the
# magic itself.
return evaluator.goto_definitions(context, leaf)
if prefer_stubs:
return evaluator.goto_stub_definitions(context, leaf)
else:
return evaluator.goto_definitions(context, leaf)
parent = leaf.parent
if parent.type == 'atom':
@@ -256,5 +259,6 @@ def cache_call_signatures(evaluator, context, bracket_leaf, code_lines, user_pos
yield evaluate_goto_definition(
evaluator,
context,
bracket_leaf.get_previous_leaf()
bracket_leaf.get_previous_leaf(),
prefer_stubs=True,
)