diff --git a/topics/basics/architectural_overview/coroutines/coroutine_scopes.md b/topics/basics/architectural_overview/coroutines/coroutine_scopes.md index 4ee8aa036..5e994e2e9 100644 --- a/topics/basics/architectural_overview/coroutines/coroutine_scopes.md +++ b/topics/basics/architectural_overview/coroutines/coroutine_scopes.md @@ -63,8 +63,10 @@ application/project [services](plugin_services.md) provided by a plugin. ### Service Scopes -The **Application Service** and **Project Service** scopes are bound to an application and project [service](plugin_services.md) lifetimes accordingly. -They are children of the [](#intersection-scopes), which means that they are canceled when the application/project is closed or a plugin is unloaded. + + +The **Application Service** and **Project Service** scopes are bound to an application and project [service](plugin_services.md#types) lifetimes accordingly. +They are children of the [](coroutine_scopes.md#intersection-scopes), which means that they are canceled when the application/project is closed or a plugin is unloaded. The service scope is provided to services via constructor injection. The following constructor signatures are supported: @@ -75,6 +77,10 @@ The following constructor signatures are supported: Each service instance receives its own scope instance. The injected scopes' contexts contain [`Dispatchers.Default`](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-dispatchers/-default.html) and [`CoroutineName(serviceClass)`](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-name/). +See [](launching_coroutines.md#launching-coroutine-from-service-scope) for full samples. + + + ## Using a Correct Scope ### Use Service Scopes diff --git a/topics/basics/plugin_structure/plugin_services.md b/topics/basics/plugin_structure/plugin_services.md index d7375c39e..6ffa68090 100644 --- a/topics/basics/plugin_structure/plugin_services.md +++ b/topics/basics/plugin_structure/plugin_services.md @@ -34,9 +34,6 @@ To improve startup performance, avoid any heavy initializations in the construct Project/Module-level service constructors can have a [`Project`](%gh-ic%/platform/core-api/src/com/intellij/openapi/project/Project.java)/[`Module`](%gh-ic%/platform/core-api/src/com/intellij/openapi/module/Module.java) argument. -When using [](kotlin_coroutines.md), a distinct [Service Scope](coroutine_scopes.md#service-scopes) can be injected as parameter. -See [](launching_coroutines.md#launching-coroutine-from-service-scope) for full samples. - > Using constructor injection of dependency services is deprecated (and not supported in [](#light-services)) for performance reasons. > > Other service dependencies must be [acquired only when needed](#retrieving-a-service) in all corresponding methods, e.g., if you need a service to get some data or execute a task, retrieve the service before calling its methods. @@ -46,6 +43,12 @@ See [](launching_coroutines.md#launching-coroutine-from-service-scope) for full > {style="warning" title="Do not use Constructor Injection"} +##### Kotlin Coroutines + +When using [](kotlin_coroutines.md), a distinct service [scope](coroutine_scopes.md) can be injected as parameter. + + + ## Light Services A service not going to be overridden does not need to be registered in [plugin.xml](plugin_configuration_file.md) (see [](#declaring-a-service)).