@@ -27,6 +27,7 @@ import com.intellij.ide.scratch.ScratchRootType
27
27
import com.intellij.openapi.actionSystem.ActionManager
28
28
import com.intellij.openapi.actionSystem.DefaultActionGroup
29
29
import com.intellij.openapi.application.ApplicationManager
30
+ import com.intellij.openapi.application.invokeLater
30
31
import com.intellij.openapi.application.runInEdt
31
32
import com.intellij.openapi.application.runReadAction
32
33
import com.intellij.openapi.application.runWriteAction
@@ -101,34 +102,35 @@ open class DevInsRunConfigurationProfileState(
101
102
}
102
103
103
104
// save the run result
104
- val compiler = DevInsCompiler (myProject, file)
105
- val compileResult = compiler.compile()
105
+ invokeLater {
106
+ val compiler = DevInsCompiler (myProject, file)
107
+ val compileResult = compiler.compile()
106
108
107
- myProject.service<DevInsConversationService >().createConversation(configuration.getScriptPath(), compileResult)
109
+ myProject.service<DevInsConversationService >().createConversation(configuration.getScriptPath(), compileResult)
108
110
109
- val output = compileResult.output
110
- val agent = compileResult.executeAgent
111
+ val output = compileResult.output
112
+ val agent = compileResult.executeAgent
111
113
112
- output.split(" \n " ).forEach {
113
- if (it.contains(DEVINS_ERROR )) {
114
- console.print (it, ConsoleViewContentType .LOG_ERROR_OUTPUT )
115
- } else {
116
- console.print (it, ConsoleViewContentType .USER_INPUT )
114
+ output.split(" \n " ).forEach {
115
+ if (it.contains(DEVINS_ERROR )) {
116
+ console.print (it, ConsoleViewContentType .LOG_ERROR_OUTPUT )
117
+ } else {
118
+ console.print (it, ConsoleViewContentType .USER_INPUT )
119
+ }
120
+ console.print (" \n " , ConsoleViewContentType .NORMAL_OUTPUT )
117
121
}
118
- console.print (" \n " , ConsoleViewContentType .NORMAL_OUTPUT )
119
- }
120
122
121
- console.print (" \n --------------------\n " , ConsoleViewContentType .NORMAL_OUTPUT )
123
+ console.print (" \n --------------------\n " , ConsoleViewContentType .NORMAL_OUTPUT )
122
124
123
- if (output.contains(DEVINS_ERROR )) {
124
- processHandler.exitWithError()
125
- return DefaultExecutionResult (console, processHandler)
126
- }
127
-
128
- if (agent != null ) {
129
- agentRun (output, console, processHandler, agent )
130
- } else {
131
- defaultRun(output, console, processHandler, compileResult.isLocalCommand)
125
+ if (output.contains(DEVINS_ERROR )) {
126
+ processHandler.exitWithError()
127
+ } else {
128
+ if (agent != null ) {
129
+ agentRun(output, console, processHandler, agent)
130
+ } else {
131
+ defaultRun (output, console, processHandler, compileResult.isLocalCommand )
132
+ }
133
+ }
132
134
}
133
135
134
136
return DefaultExecutionResult (console, processHandler)
0 commit comments