diff --git a/pycharm/src/main/kotlin/cc/unitmesh/pycharm/PythonFrameworkContextProvider.kt b/pycharm/src/main/kotlin/cc/unitmesh/pycharm/PythonFrameworkContextProvider.kt index f0385f7f7c..5e083a4f11 100644 --- a/pycharm/src/main/kotlin/cc/unitmesh/pycharm/PythonFrameworkContextProvider.kt +++ b/pycharm/src/main/kotlin/cc/unitmesh/pycharm/PythonFrameworkContextProvider.kt @@ -6,18 +6,30 @@ import cc.unitmesh.devti.provider.context.ChatCreationContext import com.intellij.openapi.project.Project import com.intellij.openapi.project.modules import com.jetbrains.python.PythonLanguage +import com.jetbrains.python.packaging.PyPackage +import com.jetbrains.python.packaging.tryCreateCustomPackageManager import com.jetbrains.python.sdk.configuration.PyProjectSdkConfigurationExtension -class PythonFrameworkContextProvider: ChatContextProvider { +class PythonFrameworkContextProvider : ChatContextProvider { override fun isApplicable(project: Project, creationContext: ChatCreationContext): Boolean { println(creationContext.element?.language) return creationContext.element?.language is PythonLanguage } override suspend fun collect(project: Project, creationContext: ChatCreationContext): List { - project.modules.asSequence() - .map { PyProjectSdkConfigurationExtension.findForModule(it) } - .forEach { println(it) } +// val configures: List = project.modules.asSequence() +// .mapNotNull { +// val pair = PyProjectSdkConfigurationExtension.findForModule(it) +// pair?.second?.createAndAddSdkForInspection(it) +// } +// .mapNotNull { +// tryCreateCustomPackageManager(it)?.packages +// } +// .flatten().toList() +// +// configures.forEach { +// println(it) +// } return listOf() }