Skip to content

Commit 193808f

Browse files
committed
refactor(test): remove redundant cancellation checks in test generation
1 parent 9d02979 commit 193808f

File tree

2 files changed

+0
-8
lines changed

2 files changed

+0
-8
lines changed

core/src/main/kotlin/cc/unitmesh/devti/actions/chat/AutoTestInMenuAction.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ class AutoTestInMenuAction : AnAction(AutoDevBundle.message("intentions.chat.cod
7272
indicator.fraction = 0.0
7373

7474
files.forEachIndexed { index, file ->
75-
// Check for cancellation before processing each file
7675
indicator.checkCanceled()
7776

7877
indicator.text = "Processing ${index + 1}/$total: ${file.name}"
@@ -87,11 +86,9 @@ class AutoTestInMenuAction : AnAction(AutoDevBundle.message("intentions.chat.cod
8786
task.run(indicator)
8887
indicator.fraction = (index + 1).toDouble() / total
8988
} catch (e: ProcessCanceledException) {
90-
// User cancelled, stop processing
9189
indicator.text = "Batch test generation cancelled"
9290
throw e
9391
} catch (e: Exception) {
94-
// Log error but continue with next file
9592
logger.warn("Failed to generate test for file: ${file.name}", e)
9693
indicator.fraction = (index + 1).toDouble() / total
9794
}

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,12 @@ class TestCodeGenTask(val request: TestCodeGenRequest, displayMessage: String) :
5454
indicator.fraction = 0.1
5555
indicator.text = AutoDevBundle.message("intentions.chat.code.test.step.prepare-context")
5656

57-
// Check for cancellation early
5857
indicator.checkCanceled()
5958

6059
AutoDevStatusService.notifyApplication(AutoDevStatus.InProgress)
6160
val testContext = autoTestService.findOrCreateTestFile(request.file, request.project, request.element)
6261
DumbService.getInstance(request.project).waitForSmartMode()
6362

64-
// Check for cancellation after waiting for smart mode
6563
indicator.checkCanceled()
6664

6765
if (testContext == null) {
@@ -73,7 +71,6 @@ class TestCodeGenTask(val request: TestCodeGenRequest, displayMessage: String) :
7371
indicator.text = AutoDevBundle.message("intentions.chat.code.test.step.collect-context")
7472
indicator.fraction = 0.3
7573

76-
// Check for cancellation before collecting context
7774
indicator.checkCanceled()
7875

7976
val testPromptContext = TestCodeGenContext()
@@ -90,8 +87,6 @@ class TestCodeGenTask(val request: TestCodeGenRequest, displayMessage: String) :
9087
}
9188

9289
testPromptContext.frameworkContext = contextItems.joinToString("\n", transform = ChatContextItem::text)
93-
94-
// Check for cancellation before read actions
9590
indicator.checkCanceled()
9691

9792
ReadAction.compute<Unit, Throwable> {

0 commit comments

Comments
 (0)