Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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 {
Expand All @@ -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 <reified T : Any> 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 <reified T : Any> 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 <reified T : Any> T.disposableCoroutineScope(disposable: Disposable): CoroutineScope =
disposableCoroutineScope(disposable, T::class.java.name)

Expand Down