Skip to content

Commit ec7a607

Browse files
committed
feat(commands): add BROWSE to READ_COMMANDS and simplify BrowseInsCommand
Add BROWSE command to the READ_COMMANDS set and streamline the BrowseInsCommand implementation by removing unnecessary EDT execution code.
1 parent 0ebd2ac commit ec7a607

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

core/src/main/kotlin/cc/unitmesh/devti/devin/dataprovider/BuiltinCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,6 @@ enum class BuiltinCommand(
126126

127127
fun fromString(agentName: String): BuiltinCommand? = values().find { it.commandName == agentName }
128128

129-
val READ_COMMANDS = setOf(DIR, LOCAL_SEARCH, FILE, REV, STRUCTURE, SYMBOL, DATABASE, RELATED, RIPGREP_SEARCH)
129+
val READ_COMMANDS = setOf(DIR, LOCAL_SEARCH, FILE, REV, STRUCTURE, SYMBOL, DATABASE, RELATED, RIPGREP_SEARCH, BROWSE)
130130
}
131131
}
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
package cc.unitmesh.devti.language.compiler.exec
22

3+
import cc.unitmesh.devti.agenttool.browse.BrowseTool
34
import cc.unitmesh.devti.devin.InsCommand
45
import cc.unitmesh.devti.devin.dataprovider.BuiltinCommand
5-
import cc.unitmesh.devti.agenttool.browse.BrowseTool
6-
import com.intellij.openapi.application.runInEdt
76
import com.intellij.openapi.project.Project
87

98
class BrowseInsCommand(val myProject: Project, private val prop: String) : InsCommand {
109
override val commandName: BuiltinCommand = BuiltinCommand.BROWSE
11-
override suspend fun execute(): String? {
12-
var body: String? = null
13-
runInEdt {
14-
val parse = BrowseTool.parse(prop)
15-
body = parse.body
16-
}
1710

18-
return body
11+
override suspend fun execute(): String? {
12+
val parse = BrowseTool.parse(prop)
13+
return parse.body
1914
}
2015
}
2116

0 commit comments

Comments
 (0)