Search in sources :

Example 1 with PyImportCandidateProvider

use of com.jetbrains.python.codeInsight.imports.PyImportCandidateProvider in project intellij by bazelbuild.

the class PyImportResolverStrategyTestCase method getImportQuickFix.

static AutoImportQuickFix getImportQuickFix(PyElement unresolvedSymbol) {
    PsiReference ref = unresolvedSymbol.getReference();
    assertThat(ref).isNotNull();
    String text = ref.getElement().getText();
    AutoImportQuickFix fix = new AutoImportQuickFix(unresolvedSymbol, ref.getClass(), text, false);
    for (PyImportCandidateProvider provider : Extensions.getExtensions(PyImportCandidateProvider.EP_NAME)) {
        provider.addImportCandidates(ref, text, fix);
    }
    fix.sortCandidates();
    return fix;
}
Also used : PsiReference(com.intellij.psi.PsiReference) PyImportCandidateProvider(com.jetbrains.python.codeInsight.imports.PyImportCandidateProvider) AutoImportQuickFix(com.jetbrains.python.codeInsight.imports.AutoImportQuickFix)

Aggregations

PsiReference (com.intellij.psi.PsiReference)1 AutoImportQuickFix (com.jetbrains.python.codeInsight.imports.AutoImportQuickFix)1 PyImportCandidateProvider (com.jetbrains.python.codeInsight.imports.PyImportCandidateProvider)1