IntelliJ Platform Plugin SDK
 
IntelliJ Platform Explorer

Execution Contexts

Edit pageLast modified: 21 February 2025

The IntelliJ Platform provides APIs that allow tracking the progress of background processes and canceling their execution when they are canceled by a user, or they become obsolete due to some changes in the data model.

Available execution contexts differ depending on the IntelliJ Platform version. For the details, select the required tab below.

Background processes can be executed in two contexts:

Currently, the Progress Indicator context is the most widely used approach in the IntelliJ Platform. As the platform's execution model moves towards coroutines, this approach can be considered obsolete.

Starting with 2024.2, it is recommended to execute new code in the Coroutine Execution Context.

The following sections explain the contexts and provide information about process cancellation, progress tracking, and switching between contexts.

Coroutine Execution Context

Code executed in Kotlin coroutines is executed in the Coroutine Execution Context. Since 2024.2, coroutines are recommended for executing background tasks to maximize CPU utilization. Note that executing code in coroutines is possible only with Kotlin.

While code executed in the Coroutine Execution Context should use suspending functions, sometimes it is required to call non-suspending/blocking APIs that use methods such as ProgressManager.checkCanceled() or ModalityState.defaultModalityState(). Since 2024.2, these methods work as expected without the need to switch to the Blocking Context explicitly with blockingContext() (in 2024.2+, it is effectively a no-operation function).