Skip to content

Commit 7914ec2

Browse files
committed
fix: fix auto completion lost request
1 parent 4ed6501 commit 7914ec2

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

src/main/kotlin/cc/unitmesh/devti/intentions/action/CodeCompletionIntention.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class CodeCompletionIntention : AbstractChatIntention() {
4949

5050
val request = CodeCompletionRequest.create(editor, offset, element, prefix, suffix) ?: return
5151
val task = CodeCompletionTask(request)
52-
ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, BackgroundableProcessIndicator(task))
52+
ProgressManager.getInstance()
53+
.runProcessWithProgressAsynchronously(task, BackgroundableProcessIndicator(task))
5354
}
5455

5556
companion object {

src/main/kotlin/cc/unitmesh/devti/intentions/action/task/BaseCompletionTask.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ abstract class BaseCompletionTask(private val request: CodeCompletionRequest) :
2929
open fun keepHistory(): Boolean = true
3030

3131
override fun run(indicator: ProgressIndicator) {
32+
indicator.isIndeterminate = true
33+
indicator.fraction = 0.1
34+
indicator.text = AutoDevBundle.message("intentions.chat.code.test.step.prepare-context")
35+
3236
val prompt = promptText()
3337
val flow: Flow<String> = LlmFactory().create(request.project).stream(prompt, "", keepHistory())
3438
logger.info("Prompt: $prompt")
@@ -46,6 +50,10 @@ abstract class BaseCompletionTask(private val request: CodeCompletionRequest) :
4650
val project = request.project
4751
var currentOffset = request.offset
4852

53+
indicator.isIndeterminate = true
54+
indicator.fraction = 0.8
55+
indicator.text = AutoDevBundle.message("intentions.request.background.process.title")
56+
4957
LLMCoroutineScope.scope(request.project).launch {
5058
val suggestion = StringBuilder()
5159

src/main/kotlin/cc/unitmesh/devti/intentions/action/task/TestCodeGenTask.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class TestCodeGenTask(val request: TestCodeGenRequest) :
105105
logger<AutoTestThisIntention>().info("Prompt: $prompter")
106106

107107
indicator.fraction = 0.8
108-
indicator.text = AutoDevBundle.message("intentions.chat.code.test.step.prompt")
108+
indicator.text = AutoDevBundle.message("intentions.request.background.process.title")
109109

110110
runBlocking {
111111
writeTestToFile(request.project, flow, testContext)

src/main/resources/messages/AutoDevBundle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ intentions.assistant.name=AutoDev AI AutoAction
2020
intentions.assistant.popup.title=AutoDev AI Assistant
2121

2222
intentions.chat.code.test.step.prepare-context=Prepare context
23-
intentions.chat.code.test.step.prompt=Prompting to LLM
2423
intentions.chat.code.test.step.collect-context=Collect prompt context
2524
intentions.chat.code.complete.name=Code complete
2625
intentions.chat.code.complete.family.name=Code complete

0 commit comments

Comments
 (0)