mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix usages of broken PythonSdkType.getSdk method, which didn't take in account a Python facet configuration.
This commit is contained in:
+1
-1
@@ -74,7 +74,7 @@ public class PythonBaseProjectGenerator extends PythonProjectGenerator<PyNewProj
|
||||
@NotNull
|
||||
@Override
|
||||
public ValidationResult validate(@NotNull String baseDirPath) {
|
||||
/*if (PythonSdkType.isRemote(myProjectAction.getSdk())) {
|
||||
/*if (PythonSdkType.isRemote(myProjectAction.findPythonSdk())) {
|
||||
if (PythonRemoteInterpreterManager.getInstance() == null) {
|
||||
return new ValidationResult(PythonRemoteInterpreterManager.WEB_DEPLOYMENT_PLUGIN_IS_DISABLED);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class PyUserSkeletonsUtil {
|
||||
|
||||
@Nullable
|
||||
public static PyFile getUserSkeletonForModuleQName(@NotNull String qName, @NotNull PsiElement foothold) {
|
||||
final Sdk sdk = PythonSdkType.getSdk(foothold);
|
||||
final Sdk sdk = PythonSdkType.findPythonSdk(foothold);
|
||||
if (sdk != null) {
|
||||
final Project project = foothold.getProject();
|
||||
final PythonSdkPathCache cache = PythonSdkPathCache.getInstance(project, sdk);
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ public class PyUnresolvedReferencesInspection extends PyInspection {
|
||||
myIsEnabled = false;
|
||||
}
|
||||
else if (isPyCharm) {
|
||||
myIsEnabled = PythonSdkType.getSdk(anchor) != null || PyUtil.isInScratchFile(anchor);
|
||||
myIsEnabled = PythonSdkType.findPythonSdk(anchor) != null || PyUtil.isInScratchFile(anchor);
|
||||
}
|
||||
else {
|
||||
myIsEnabled = true;
|
||||
|
||||
@@ -166,7 +166,7 @@ private fun relativeResultsFromSkeletons(name: QualifiedName, context: PyQualifi
|
||||
val containingName = QualifiedNameFinder.findCanonicalImportPath(containingDirectory, null)
|
||||
if (containingName != null && containingName.componentCount > 0) {
|
||||
val absoluteName = containingName.append(name)
|
||||
val sdk = PythonSdkType.getSdk(footholdFile) ?: return emptyList()
|
||||
val sdk = PythonSdkType.findPythonSdk(footholdFile) ?: return emptyList()
|
||||
val skeletonsVirtualFile = PySdkUtil.findSkeletonsDir(sdk) ?: return emptyList()
|
||||
val skeletonsDir = context.psiManager.findDirectory(skeletonsVirtualFile)
|
||||
return resolveModuleAt(absoluteName, skeletonsDir, context)
|
||||
|
||||
@@ -199,7 +199,7 @@ public class PySdkUtil {
|
||||
if (file != null) {
|
||||
final VirtualFile virtualFile = file.getVirtualFile();
|
||||
if (virtualFile != null) {
|
||||
final Sdk sdk = PythonSdkType.getSdk(element);
|
||||
final Sdk sdk = PythonSdkType.findPythonSdk(element);
|
||||
if (sdk != null) {
|
||||
final VirtualFile skeletonsDir = findSkeletonsDir(sdk);
|
||||
if (skeletonsDir != null && VfsUtilCore.isAncestor(skeletonsDir, virtualFile, false)) {
|
||||
|
||||
@@ -692,6 +692,11 @@ public final class PythonSdkType extends SdkType {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Sdk findPythonSdk(@NotNull final PsiElement element) {
|
||||
return findPythonSdk(ModuleUtilCore.findModuleForPsiElement(element));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Sdk findSdkByPath(@Nullable String path) {
|
||||
if (path != null) {
|
||||
@@ -901,13 +906,10 @@ public final class PythonSdkType extends SdkType {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Nullable
|
||||
public static Sdk getSdk(@NotNull final PsiElement element) {
|
||||
Module module = ModuleUtilCore.findModuleForPsiElement(element);
|
||||
if (module == null) {
|
||||
return null;
|
||||
}
|
||||
return ModuleRootManager.getInstance(module).getSdk();
|
||||
return findPythonSdk(element);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user