Use completions from both stubs and actual modules

This commit is contained in:
Dave Halter
2019-05-17 16:04:16 +02:00
parent c640aa9213
commit e70c49fea2
2 changed files with 32 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ from jedi.evaluate import imports
from jedi.api import keywords
from jedi.evaluate.helpers import evaluate_call_of_leaf, parse_dotted_names
from jedi.evaluate.filters import get_global_filters
from jedi.evaluate.gradual.conversion import stub_to_actual_context_set
from jedi.parser_utils import get_statement_of_position
@@ -238,6 +239,13 @@ class Completion:
for filter in context.get_filters(
search_global=False, origin_scope=user_context.tree_node):
completion_names += filter.values()
for context in contexts:
stub_contexts = stub_to_actual_context_set(context, ignore_compiled=True)
for stub_context in stub_contexts:
for filter in stub_context.get_filters(
search_global=False, origin_scope=user_context.tree_node):
completion_names += filter.values()
return completion_names
def _get_importer_names(self, names, level=0, only_modules=True):

View File

@@ -22,6 +22,11 @@ with_stub.in_with_stub_python
#! ['in_with_stub_stub: float']
with_stub.in_with_stub_stub
#? ['in_stub_only']
stub_only.in_
#? ['in_with_stub_both', 'in_with_stub_python', 'in_with_stub_stub']
with_stub.in_
# -------------------------
# Folders
# -------------------------
@@ -35,6 +40,11 @@ with_stub_folder.in_with_stub_python_folder
#? float()
with_stub_folder.in_with_stub_stub_folder
#? ['in_stub_only_folder']
stub_only_folder.in_
#? ['in_with_stub_both_folder', 'in_with_stub_python_folder', 'in_with_stub_stub_folder']
with_stub_folder.in_
# -------------------------
# Folders nested with stubs
# -------------------------
@@ -53,6 +63,13 @@ nested_with_stub.in_stub
#? str()
python_only.in_python
#? ['in_stub_only_folder']
stub_only_folder.in_
#? ['in_with_stub_both_folder', 'in_with_stub_python_folder', 'in_with_stub_stub_folder']
with_stub_folder.in_
#? ['in_python']
python_only.in_
# -------------------------
# Folders nested with stubs
# -------------------------
@@ -70,3 +87,10 @@ nested_with_stub.in_python
nested_with_stub.in_stub
#? str()
python_only.in_python
#? ['in_stub_only']
nested_stub_only.in_
#? ['in_both', 'in_python', 'in_stub']
nested_with_stub.in_
#? ['in_python']
python_only.in_