Skip to content

Commit

Permalink
feat(python): add to add collect
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Aug 7, 2023
1 parent 3dd043e commit b67933f
Showing 1 changed file with 16 additions and 4 deletions.
Expand Up @@ -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<ChatContextItem> {
project.modules.asSequence()
.map { PyProjectSdkConfigurationExtension.findForModule(it) }
.forEach { println(it) }
// val configures: List<PyPackage> = 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()
}
Expand Down

0 comments on commit b67933f

Please sign in to comment.