File tree Expand file tree Collapse file tree 2 files changed +11
-13
lines changed
src/main/kotlin/cc/unitmesh/devti Expand file tree Collapse file tree 2 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,14 @@ interface RunService {
49
49
* @param virtualFile The virtual file for which the configuration should be created.
50
50
* @return The created or found run configuration settings, or `null` if no suitable configuration could be
51
51
*/
52
- fun createRunSettings (project : Project , virtualFile : VirtualFile ): RunnerAndConfigurationSettings ? {
52
+ fun createRunSettings (project : Project , virtualFile : VirtualFile , testElement : PsiElement ? ): RunnerAndConfigurationSettings ? {
53
+ if (testElement != null ) {
54
+ val settings = createDefaultTestConfigurations(project, testElement)
55
+ if (settings != null ) {
56
+ return settings
57
+ }
58
+ }
59
+
53
60
val runManager = RunManager .getInstance(project)
54
61
var testConfig = runManager.allConfigurationsList.firstOrNull {
55
62
val runConfigureClass = runConfigurationClass(project)
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ package cc.unitmesh.devti.runner
4
4
import cc.unitmesh.devti.AutoDevBundle
5
5
import cc.unitmesh.devti.provider.RunService
6
6
import com.intellij.execution.*
7
- import com.intellij.execution.actions.ConfigurationContext
8
7
import com.intellij.execution.executors.DefaultRunExecutor
9
8
import com.intellij.execution.impl.ExecutionManagerImpl
10
9
import com.intellij.execution.process.*
@@ -54,18 +53,10 @@ class RunServiceTask(
54
53
* @return The check result of the executed run configuration, or `null` if no run configuration could be created.
55
54
*/
56
55
fun doRun (indicator : ProgressIndicator ? ): RunnerResult ? {
57
- var settings: RunnerAndConfigurationSettings ? = runService.createRunSettings(project, virtualFile)
56
+ val settings: RunnerAndConfigurationSettings ? = runService.createRunSettings(project, virtualFile, testElement )
58
57
if (settings == null ) {
59
- if (testElement == null ) {
60
- logger<RunServiceTask >().error(" No run configuration found for file: ${virtualFile.path} " )
61
- return null
62
- }
63
- settings = runService.createDefaultTestConfigurations(project, testElement)
64
-
65
- if (settings == null ) {
66
- logger<RunServiceTask >().error(" No run configuration found for element: $testElement " )
67
- return null
68
- }
58
+ logger<RunServiceTask >().error(" No run configuration found for file: ${virtualFile.path} " )
59
+ return null
69
60
}
70
61
71
62
settings.isActivateToolWindowBeforeRun = false
You can’t perform that action at this time.
0 commit comments