Skip to content

Commit 1c1e391

Browse files
committed
fix(SimpleDevinPrompter): wrap VariableTemplateCompiler creation in runReadAction
1 parent 8c36b94 commit 1c1e391

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/src/main/kotlin/cc/unitmesh/devti/prompting/SimpleDevinPrompter.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ import com.intellij.openapi.project.Project
1414
import com.intellij.psi.PsiDocumentManager
1515
import cc.unitmesh.devti.intentions.action.getElementToAction
1616
import kotlinx.coroutines.runBlocking
17+
import com.intellij.openapi.application.runReadAction
1718

1819
abstract class SimpleDevinPrompter {
1920
abstract val templateRender: TemplateRender
2021
abstract val template: String
2122

2223
suspend fun prompting(project: Project, userInput: String, editor: Editor?): String {
23-
val variableCompile = VariableTemplateCompiler.create(project, editor)
24+
val variableCompile = runReadAction {
25+
VariableTemplateCompiler.create(project, editor)
26+
}
2427
if (variableCompile == null) {
2528
val frameworkContext = collectFrameworkContext(editor, project)
2629
templateRender.addVariable("input", userInput)

0 commit comments

Comments
 (0)