Skip to content

Commit c6cea24

Browse files
committed
feat(devin-lang): init design for patch and run commands #101
The DevInCompiler now supports the patch and run builtin commands, allowing for more flexibility in executing and modifying code within the language environment.
1 parent 5920d9b commit c6cea24

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

exts/devin-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/DevInCompiler.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ class DevInCompiler(val myProject: Project, val file: DevInFile, val editor: Edi
100100
BuiltinCommand.WRITE -> {
101101
output.append("/" + command.agentName)
102102
}
103+
104+
BuiltinCommand.PATCH -> {
105+
output.append("/" + command.agentName)
106+
}
107+
108+
BuiltinCommand.RUN -> {
109+
output.append("/" + command.agentName)
110+
}
103111
}
104112
}
105113

exts/devin-lang/src/main/kotlin/cc/unitmesh/devti/language/completion/BuiltinCommandProvider.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
package cc.unitmesh.devti.language.completion
22

3-
import cc.unitmesh.devti.language.DevInIcons
43
import com.intellij.codeInsight.AutoPopupController
54
import com.intellij.codeInsight.completion.*
65
import com.intellij.codeInsight.lookup.LookupElementBuilder
76
import com.intellij.icons.AllIcons
87
import com.intellij.util.ProcessingContext
98
import javax.swing.Icon
109

11-
enum class BuiltinCommand(val agentName: String, val description: String, val icon: Icon, val hasCompletion: Boolean = false) {
10+
enum class BuiltinCommand(
11+
val agentName: String,
12+
val description: String,
13+
val icon: Icon,
14+
val hasCompletion: Boolean = false
15+
) {
1216
FILE("file", "Read the content of a file", AllIcons.Actions.AddFile, true),
1317
REV("rev", "Read git change by file", AllIcons.Vcs.History, true),
1418
SYMBOL("symbol", "Read content by Java/Kotlin canonicalName", AllIcons.Actions.GroupBy),
1519
WRITE("write", "Write content to a file, /write:/path/to/file:L1-L2", AllIcons.Actions.Edit),
20+
PATCH("patch", "Apply patch to a file, /patch:/path/to/file", AllIcons.Vcs.Patch_file),
21+
RUN("run", "Run the content of a file", AllIcons.Actions.Execute),
1622
;
1723

1824
companion object {

exts/devin-lang/src/main/kotlin/cc/unitmesh/devti/language/run/DevInRunLineMarkersProvider.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import com.intellij.execution.lineMarker.RunLineMarkerContributor
88
import com.intellij.icons.AllIcons
99
import com.intellij.openapi.actionSystem.ActionManager
1010
import com.intellij.openapi.actionSystem.AnAction
11-
import com.intellij.openapi.diagnostic.logger
1211
import com.intellij.openapi.project.DumbAware
1312
import com.intellij.psi.PsiElement
1413

0 commit comments

Comments
 (0)