Skip to content

Commit b1a6c96

Browse files
committed
refactor(compiler): remove CodeFence parsing from commands #257
- Remove unnecessary CodeFence parsing in WriteInsCommand and CommitInsCommand. - Simplify CommitInsCommand to directly use commitMsg parameter.
1 parent c6e9b04 commit b1a6c96

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/exec/CommitInsCommand.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
package cc.unitmesh.devti.language.compiler.exec
22

33
import cc.unitmesh.devti.language.git.GitUtil
4-
import cc.unitmesh.devti.util.parser.CodeFence
54
import com.intellij.openapi.project.Project
65
import com.intellij.openapi.vcs.changes.ChangeListManager
76
import com.intellij.openapi.vcs.changes.LocalChangeList
87

9-
class CommitInsCommand(val myProject: Project, val code: String) : InsCommand {
8+
class CommitInsCommand(val myProject: Project, val commitMsg: String) : InsCommand {
109
override suspend fun execute(): String {
11-
val commitMsg = CodeFence.parse(code).text
12-
1310
val changeListManager = ChangeListManager.getInstance(myProject)
1411
changeListManager.changeLists.forEach {
1512
val list: LocalChangeList = changeListManager.getChangeList(it.id) ?: return@forEach

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/exec/WriteInsCommand.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ class WriteInsCommand(val myProject: Project, val argument: String, val content:
2222
private val pathSeparator = "/"
2323

2424
override suspend fun execute(): String? {
25-
val content = CodeFence.parse(content).text
26-
2725
val range: LineInfo? = LineInfo.fromString(used.text)
2826
val filepath = argument.split("#")[0]
2927
val projectDir = myProject.guessProjectDir() ?: return "$DEVINS_ERROR: Project directory not found"

0 commit comments

Comments
 (0)