kotlinx.coroutines
kotlinx.coroutines copied to clipboard
Impossible to attach coroutine context to CompletableJob
I've managed to dump the full parent-child tree via internal APIs (https://github.com/Kotlin/kotlinx.coroutines/issues/3427), and I've discovered, that the coroutine name is not attached to the Job created by CoroutineScope. The name is only copied to child coroutines as is.
val cs = CoroutineScope(CoroutineName("MyComponent"))
Another title of this issue: "CoroutineScope is not a coroutine like launch/async".
Currently, we have to use the following approach:
https://github.com/JetBrains/intellij-community/blob/8bce81b67d20a1fc0f538cc0d3c1c04b15b61790/platform/util/src/com/intellij/util/coroutineScope.kt#L25
Currently, we have to use the following approach:
https://github.com/JetBrains/intellij-community/blob/8bce81b67d20a1fc0f538cc0d3c1c04b15b61790/platform/util/src/com/intellij/util/coroutineScope.kt#L25
Excuse me, how to achieve it?
My code is as follows:

But the result is not satisfactory。 PS: Run in Android Studio
New approach: https://github.com/JetBrains/intellij-community/blob/819b1d9cd68a4638f3fa74ae445253d7e768108b/platform/util/coroutines/src/com/intellij/platform/util/coroutines/coroutineScope.kt#L41C15-L41C25