forked from VimPlug/jedi
Add only_stubs and prefer_stubs as parameters to goto_assignments/goto_definitions
This commit is contained in:
@@ -84,8 +84,6 @@ from jedi.evaluate.context import ClassContext, FunctionContext, \
|
||||
from jedi.evaluate.context.iterable import CompForContext
|
||||
from jedi.evaluate.syntax_tree import eval_trailer, eval_expr_stmt, \
|
||||
eval_node, check_tuple_assignments
|
||||
from jedi.evaluate.gradual.conversion import try_stub_to_actual_names, \
|
||||
actual_to_stub_names, try_stubs_to_actual_context_set
|
||||
|
||||
|
||||
def _execute(context, arguments):
|
||||
@@ -257,13 +255,6 @@ class Evaluator(object):
|
||||
return eval_node(context, element)
|
||||
|
||||
def goto_definitions(self, context, name):
|
||||
# We don't want stubs here we want the actual contexts, if possible.
|
||||
return try_stubs_to_actual_context_set(
|
||||
self.goto_stub_definitions(context, name),
|
||||
prefer_stub_to_compiled=True
|
||||
)
|
||||
|
||||
def goto_stub_definitions(self, context, name):
|
||||
def_ = name.get_definition(import_name_always=True)
|
||||
if def_ is not None:
|
||||
type_ = def_.type
|
||||
|
||||
@@ -136,6 +136,14 @@ def actual_to_stub_names(names, fallback_to_actual=False):
|
||||
yield name
|
||||
|
||||
|
||||
def convert_names(names, only_stubs, prefer_stubs):
|
||||
with debug.increase_indent_cm('convert names'):
|
||||
if only_stubs or prefer_stubs:
|
||||
return actual_to_stub_names(names, fallback_to_actual=prefer_stubs)
|
||||
else:
|
||||
return try_stub_to_actual_names(names, prefer_stub_to_compiled=True)
|
||||
|
||||
|
||||
def to_stub(context):
|
||||
if context.is_stub():
|
||||
return ContextSet([context])
|
||||
|
||||
Reference in New Issue
Block a user