Skip to content

Commit bd4b424

Browse files
committed
refactor(devins-lang): refactor reorg conversation #100
Refactored `DevInsRunConfigurationProfileState` to use a new `DevInsProcessHandler` class, removing the dependency on `BuildProcessHandler`. This change improves the code structure and readability, making it easier to maintain and extend the conversation system.
1 parent 3d2105b commit bd4b424

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package cc.unitmesh.devti.language.run
2+
3+
import com.intellij.build.process.BuildProcessHandler
4+
import java.io.OutputStream
5+
6+
class DevInsProcessHandler(private val myExecutionName: String) : BuildProcessHandler() {
7+
override fun detachIsDefault(): Boolean = false
8+
override fun destroyProcessImpl() = Unit
9+
override fun detachProcessImpl() = notifyProcessTerminated(0)
10+
fun exitWithError() = notifyProcessTerminated(-1)
11+
12+
override fun getProcessInput(): OutputStream? = null
13+
override fun getExecutionName(): String = myExecutionName
14+
}

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/run/DevInsRunConfigurationProfileState.kt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import cc.unitmesh.devti.language.status.DevInsRunListener
99
import cc.unitmesh.devti.llms.LLMProvider
1010
import cc.unitmesh.devti.llms.LlmFactory
1111
import cc.unitmesh.devti.util.LLMCoroutineScope
12-
import com.intellij.build.process.BuildProcessHandler
1312
import com.intellij.execution.DefaultExecutionResult
1413
import com.intellij.execution.ExecutionResult
1514
import com.intellij.execution.Executor
@@ -33,7 +32,6 @@ import kotlinx.coroutines.flow.*
3332
import kotlinx.coroutines.launch
3433
import kotlinx.coroutines.runBlocking
3534
import java.awt.BorderLayout
36-
import java.io.OutputStream
3735
import javax.swing.JComponent
3836

3937
open class DevInsRunConfigurationProfileState(
@@ -43,7 +41,7 @@ open class DevInsRunConfigurationProfileState(
4341
private val llm: LLMProvider = LlmFactory.instance.create(myProject)
4442

4543
override fun execute(executor: Executor?, runner: ProgramRunner<*>): ExecutionResult {
46-
val processHandler = DevInsProcessBuilder(configuration.name)
44+
val processHandler = DevInsProcessHandler(configuration.name)
4745
ProcessTerminatedListener.attach(processHandler)
4846

4947
val sb = StringBuilder()
@@ -188,12 +186,3 @@ open class DevInsRunConfigurationProfileState(
188186
}
189187
}
190188

191-
class DevInsProcessBuilder(private val myExecutionName: String) : BuildProcessHandler() {
192-
override fun detachIsDefault(): Boolean = false
193-
override fun destroyProcessImpl() = Unit
194-
override fun detachProcessImpl() = notifyProcessTerminated(0)
195-
fun exitWithError() = notifyProcessTerminated(-1)
196-
197-
override fun getProcessInput(): OutputStream? = null
198-
override fun getExecutionName(): String = myExecutionName
199-
}

0 commit comments

Comments
 (0)