Skip to content

Commit

Permalink
feat: init vcs for detect cchange
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Jul 12, 2023
1 parent 377df63 commit 98261d7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/kotlin/cc/unitmesh/devti/prompting/JavaActionPrompting.kt
Expand Up @@ -13,6 +13,7 @@ import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.externalSystem.model.project.LibraryData
import com.intellij.openapi.externalSystem.service.project.ProjectDataManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.vcs.changes.ChangeListManagerImpl
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.psi.JavaPsiFacade
import com.intellij.psi.PsiClass
Expand Down Expand Up @@ -196,13 +197,23 @@ class JavaActionPrompting(

ChatBotActionType.GEN_COMMIT_MESSAGE -> {
prompt = "gen commit message"
prepareVcsContext(selectedText)
// todo: add context
}
}

return prompt
}

// TODO: move all manager to services?
private val changeListManager = ChangeListManagerImpl(project)
private fun prepareVcsContext(selectedText: String) {
changeListManager.changeLists.forEach {
logger.warn(it.data.toString())
logger.warn(it.toString())
}
}

private fun prepareLibrary(): TestStack {
val projectData = ProjectDataManager.getInstance().getExternalProjectData(
project, GradleConstants.SYSTEM_ID, project.basePath!!
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/plugin.xml
Expand Up @@ -9,6 +9,7 @@
<depends>org.jetbrains.plugins.gradle</depends>
<!-- <depends>org.intellij.groovy</depends>-->
<!-- <depends>org.jetbrains.idea.gradle.dsl</depends>-->
<depends>com.intellij.modules.vcs</depends>

<resource-bundle>messages.AutoDevBundle</resource-bundle>

Expand Down

0 comments on commit 98261d7

Please sign in to comment.