diff --git a/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/coroutines/scopes.kt b/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/coroutines/scopes.kt index 119863c7da7..8873477a54a 100644 --- a/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/coroutines/scopes.kt +++ b/plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/coroutines/scopes.kt @@ -19,6 +19,7 @@ import java.util.concurrent.CancellationException * * Use this if the coroutine needs to live past a project being closed or across projects such as an Application Service */ +@Deprecated("Application x plugin intersection scope should not be used https://plugins.jetbrains.com/docs/intellij/coroutine-scopes.html#use-service-scopes") fun applicationCoroutineScope(coroutineName: String): CoroutineScope = PluginCoroutineScopeTracker.getInstance().applicationThreadPoolScope(coroutineName) @@ -27,6 +28,7 @@ fun applicationCoroutineScope(coroutineName: String): CoroutineScope = * * Use this if the coroutine needs to live past a UI being closed, or tied to a project's life cycle such as a Project Service. */ +@Deprecated("Project x plugin intersection scope should not be used https://plugins.jetbrains.com/docs/intellij/coroutine-scopes.html#use-service-scopes") fun projectCoroutineScope(project: Project, coroutineName: String): CoroutineScope = PluginCoroutineScopeTracker.getInstance(project).applicationThreadPoolScope(coroutineName) @@ -38,6 +40,9 @@ fun projectCoroutineScope(project: Project, coroutineName: String): CoroutineSco * **Note: If a call lives past the closing of a UI such as kicking off a resource creation, use [projectCoroutineScope]. * Otherwise, the coroutine will be canceled when the UI is closed!** */ +@Deprecated( + "Coroutine scope should not be shared across entire plugin lifecycle https://plugins.jetbrains.com/docs/intellij/coroutine-scopes.html#use-service-scopes" +) fun disposableCoroutineScope(disposable: Disposable, coroutineName: String): CoroutineScope { check(disposable !is Project && disposable !is Application) { "disposable should not be a project or application" } return PluginCoroutineScopeTracker.getInstance().applicationThreadPoolScope(coroutineName).also { @@ -50,18 +55,23 @@ fun disposableCoroutineScope(disposable: Disposable, coroutineName: String): Cor /** * Version of [applicationCoroutineScope] the class name as the coroutine name. */ +@Deprecated("Application x plugin intersection scope should not be used https://plugins.jetbrains.com/docs/intellij/coroutine-scopes.html#use-service-scopes") inline fun T.applicationCoroutineScope(): CoroutineScope = applicationCoroutineScope(T::class.java.name) /** * Version of [projectCoroutineScope] the class name as the coroutine name. */ +@Deprecated("Project x plugin intersection scope should not be used https://plugins.jetbrains.com/docs/intellij/coroutine-scopes.html#use-service-scopes") inline fun T.projectCoroutineScope(project: Project): CoroutineScope = projectCoroutineScope(project, T::class.java.name) /** * Version of [disposableCoroutineScope] the class name as the coroutine name. */ +@Deprecated( + "Coroutine scope should not be shared across entire plugin lifecycle https://plugins.jetbrains.com/docs/intellij/coroutine-scopes.html#use-service-scopes" +) inline fun T.disposableCoroutineScope(disposable: Disposable): CoroutineScope = disposableCoroutineScope(disposable, T::class.java.name)