Skip to content

Commit

Permalink
fix(devin-lang): improve logging and fix compilation errors #101
Browse files Browse the repository at this point in the history
The commit addresses two issues in the `DevInLanguage` plugin:
1. It replaces `warn` logging with `info` logging to provide more useful information during execution.
2. It fixes compilation errors by updating the import statements and removing unnecessary code.

These changes enhance the stability and usability of the plugin.
  • Loading branch information
phodal committed Mar 15, 2024
1 parent 1ea0bb8 commit 9443239
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
Expand Up @@ -23,7 +23,6 @@ class DevInRunFileAction : DumbAwareAction() {
override fun update(e: AnActionEvent) {
val file = e.getData(CommonDataKeys.PSI_FILE) ?: return
e.presentation.isEnabledAndVisible = file is DevInFile
logger<DevInRunFileAction>().warn("update: ${e.presentation.text}")

if (e.presentation.text.isNullOrBlank()) {
e.presentation.text = "Run DevIn file: ${file.name}"
Expand Down
Expand Up @@ -2,21 +2,15 @@ package cc.unitmesh.devti.language.compiler

import cc.unitmesh.devti.AutoDevBundle
import cc.unitmesh.devti.vcs.VcsPrompting
import com.intellij.codeInsight.lookup.LookupElementBuilder
import com.intellij.icons.AllIcons
import com.intellij.openapi.components.service
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.progress.Task
import com.intellij.openapi.progress.impl.BackgroundableProcessIndicator
import com.intellij.openapi.progress.runBlockingCancellable
import com.intellij.openapi.project.Project
import com.intellij.openapi.vcs.changes.Change
import git4idea.GitCommit
import git4idea.GitRevisionNumber
import git4idea.changes.GitCommittedChangeList
import git4idea.changes.GitCommittedChangeListProvider
import git4idea.history.GitHistoryUtils
import git4idea.repo.GitRepositoryManager
import kotlinx.coroutines.future.await
import kotlinx.coroutines.runBlocking
Expand All @@ -26,27 +20,15 @@ import java.util.concurrent.CompletableFuture
class RevAutoCommand(private val myProject: Project, private val revision: String) : AutoCommand {
override fun execute(): String? {
val repository = GitRepositoryManager.getInstance(myProject).repositories.firstOrNull() ?: return null

// val changeList =
// GitCommittedChangeListProvider.getCommittedChangeList(
// myProject,
// repository.root,
// GitRevisionNumber(revision)
// )

// return changeList?.changes?.joinToString("\n") { it.toString() }

val future = CompletableFuture<List<Change>>()

val task = object : Task.Backgroundable(myProject, AutoDevBundle.message("devin.ref.loading"), false) {
override fun run(indicator: ProgressIndicator) {
val committedChangeList = GitCommittedChangeListProvider.getCommittedChangeList(
myProject!!,
repository.root,
GitRevisionNumber(revision)
)

myProject!!, repository.root, GitRevisionNumber(revision)
)?.changes?.toList()

future.complete(committedChangeList?.changes?.toList())
future.complete(committedChangeList)
}
}

Expand Down
Expand Up @@ -17,8 +17,6 @@ class DevInRunLineMarkersProvider : RunLineMarkerContributor(), DumbAware {
if (element.language !is DevInLanguage) return null
val psiFile = element as? DevInFile ?: return null

logger<DevInRunLineMarkersProvider>().warn("offset: ${element.textRange}")

val actions = arrayOf<AnAction>(ActionManager.getInstance().getAction(DevInRunFileAction.ID))

return Info(
Expand Down

0 comments on commit 9443239

Please sign in to comment.