File tree Expand file tree Collapse file tree 2 files changed +37
-11
lines changed
src/IC-243/kotlin/io/kotest/plugin/intellij/psi Expand file tree Collapse file tree 2 files changed +37
-11
lines changed Original file line number Diff line number Diff line change @@ -111,17 +111,11 @@ val runWithCustomSandbox by intellijPlatformTesting.runIde.registering {
111111 }
112112}
113113
114- // tasks.named<RunIdeTask>("runIde") {
115- // jvmArgumentProviders += CommandLineArgumentProvider {
116- // listOf("-Didea.kotlin.plugin.use.k2=true")
117- // }
118- // }
119-
120- // tasks.test {
121- // jvmArgumentProviders += CommandLineArgumentProvider {
122- // listOf("-Didea.kotlin.plugin.use.k2=true")
123- // }
124- // }
114+ val runWithK2Mode by intellijPlatformTesting.runIde.registering {
115+ task {
116+ jvmArgs = listOf (" -Didea.kotlin.plugin.use.k2=true" )
117+ }
118+ }
125119
126120intellijPlatform {
127121 buildSearchableOptions = false
Original file line number Diff line number Diff line change 1+ package io.kotest.plugin.intellij.psi
2+
3+ import org.jetbrains.kotlin.analysis.api.analyze
4+ import org.jetbrains.kotlin.analysis.api.permissions.KaAllowAnalysisOnEdt
5+ import org.jetbrains.kotlin.analysis.api.permissions.allowAnalysisOnEdt
6+ import org.jetbrains.kotlin.analysis.api.types.symbol
7+ import org.jetbrains.kotlin.name.FqName
8+ import org.jetbrains.kotlin.name.StandardClassIds
9+ import org.jetbrains.kotlin.psi.KtClassOrObject
10+
11+ /* *
12+ * Recursively returns the list of classes and interfaces extended or implemented by the class.
13+ */
14+ @OptIn(KaAllowAnalysisOnEdt ::class )
15+ fun KtClassOrObject.getAllSuperClasses (): List <FqName > {
16+ return superTypeListEntries.mapNotNull { it.typeReference }
17+ .flatMap { ref ->
18+ // SurroundSelectionWithFunctionIntention.isAvailable is called in EDT before the intention is applied
19+ // unfortunately API to avoid this was introduced in 23.2 only
20+ // this we need to move intentions to the facade or accept EDT here until 23.2- are still supported
21+ allowAnalysisOnEdt {
22+ analyze(this ) {
23+ val kaType = ref.type
24+ val superTypes = (kaType.allSupertypes(false ) + kaType).toList()
25+ superTypes.mapNotNull {
26+ val classId = it.symbol?.classId?.takeIf { id -> id != StandardClassIds .Any }
27+ classId?.asSingleFqName()
28+ }
29+ }
30+ }
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments