[213 compat] deprecated method in AutoImportQuickFix
https://github.com/JetBrains/intellij-community/blob/212/python/python-psi-impl/src/com/jetbrains/python/codeInsight/imports/AutoImportQuickFix.java#:~:text=ScheduledForRemoval(inVersion%20%3D%20%222021.3%22)-,%40Deprecated,%7D,-public%20void%20addImport
@@ -31,6 +31,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
+import com.intellij.psi.PsiNamedElement;
import com.intellij.psi.PsiReference;
import com.intellij.psi.util.QualifiedName;
import com.jetbrains.python.PyNames;
@@ -80,8 +81,8 @@ public abstract class AbstractPyImportResolverStrategy implements PyImportResolv
continue;
}
PsiFile file = psi.getContainingFile();
- if (file != null) {
- quickFix.addImport(psi, file, candidate.removeLastComponent());
+ if (file != null && psi instanceof PsiNamedElement) {
+ quickFix.addImport((PsiNamedElement) psi, file, candidate.removeLastComponent());
}
}
}
