Skip to content

Commit 7aeb379

Browse files
committed
fix(intellij): stabilize test discovery at project startup
1 parent 50426a2 commit 7aeb379

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/RobotCodePostStartupActivity.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import kotlinx.coroutines.flow.onEach
1515
class RobotCodePostStartupActivity : ProjectActivity {
1616
override suspend fun execute(project: Project) {
1717
project.langServerManager.start()
18-
project.testManger.refresh()
18+
project.testManger.refreshDebounced()
1919

2020
VirtualFileManager.getInstance().addAsyncFileListener(RobotCodeVirtualFileListener(project), project.testManger)
2121

@@ -24,7 +24,7 @@ class RobotCodePostStartupActivity : ProjectActivity {
2424
if (moduleChanges.filterIsInstance<EntityChange.Replaced<ModuleEntity>>().isNotEmpty()) {
2525
project.checkPythonAndRobotVersion(true)
2626
project.langServerManager.restart()
27-
project.testManger.refresh()
27+
project.testManger.refreshDebounced()
2828
}
2929
}.collect()
3030
}

intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/configuration/RobotCodeProjectSettingsConfigurableProvider.kt

-7
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ class RobotCodeProjectSettingsConfigurable(private val project: Project) : Bound
4747
}.rowComment("Specifies robot execution mode. Corresponds to the `--rpa` or `--norpa` option of __robot__.")
4848
}
4949
group("Editing") { // TODO: not supported in IntelliJ
50-
// group("Editor") {
51-
// row {
52-
// checkBox("4 Spaces Tab").bindSelected(settings::editor4SpacesTab)
53-
// }.rowComment("If actived insert 4 spaces if TAB is pressed.")
54-
// }
5550
group("Completion") {
5651
row {
5752
checkBox("Filter Default Language").bindSelected(settings::completionFilterDefaultLanguage)
@@ -101,14 +96,12 @@ class RobotCodeProjectConfiguration :
10196
}
10297

10398
class ProjectState : BaseState() {
104-
// TODO var editor4SpacesTab by property(defaultValue = true)
10599
var completionFilterDefaultLanguage by property(defaultValue = false)
106100
var completionHeaderStyle by string()
107101
var inlayHintsParameterNames by property(defaultValue = false)
108102
var inlayHintsNamespaces by property(defaultValue = false)
109103
}
110104

111-
// TODO var editor4SpacesTab by delegate(ProjectState::editor4SpacesTab)
112105
var completionFilterDefaultLanguage by delegate(ProjectState::completionFilterDefaultLanguage)
113106
var completionHeaderStyle by stringDelegate(ProjectState::completionHeaderStyle)
114107
var inlayHintsParameterNames by delegate(ProjectState::inlayHintsParameterNames)

intellij-client/src/main/kotlin/dev/robotcode/robotcode4ij/testing/RobotCodeTestManager.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import dev.robotcode.robotcode4ij.psi.RobotSuiteFile
3232
import dev.robotcode.robotcode4ij.utils.escapeRobotGlob
3333
import kotlinx.coroutines.CoroutineScope
3434
import kotlinx.coroutines.Dispatchers
35+
import kotlinx.coroutines.ExperimentalCoroutinesApi
3536
import kotlinx.coroutines.Job
3637
import kotlinx.coroutines.delay
3738
import kotlinx.coroutines.launch
@@ -114,7 +115,8 @@ import java.util.*
114115
}
115116
}
116117

117-
private val refreshScope = CoroutineScope(Dispatchers.Default)
118+
@OptIn(ExperimentalCoroutinesApi::class)
119+
private val refreshScope = CoroutineScope(Dispatchers.IO.limitedParallelism(1))
118120

119121
fun refreshDebounced(file: VirtualFile) {
120122
if (!project.isOpen || project.isDisposed) {
@@ -129,7 +131,7 @@ import java.util.*
129131
}
130132
if (refreshJob != null) {
131133
thisLogger().info("Cancelling previous refresh job")
132-
runBlocking { refreshJob?.join() }
134+
//runBlocking { refreshJob?.join() }
133135
}
134136
refreshJobs[file] = refreshScope.launch {
135137
delay(DEBOUNCE_DELAY)

0 commit comments

Comments
 (0)