execution_contexts.topic: Repeat the content as Writerside duplicates the ID when include is executed

This commit is contained in:
Karol Lewandowski 2025-02-19 18:14:39 +01:00 committed by Karol Lewandowski
parent bbb7cadd37
commit 9a6b7e8270

View File

@ -25,14 +25,14 @@
<li><a anchor="progress-indicator"/> — obsolete since 2024.1</li> <li><a anchor="progress-indicator"/> — obsolete since 2024.1</li>
</list> </list>
<p id="progress-indicator-migration-note">Currently, the Progress Indicator context is the most widely used approach in the IntelliJ Platform. <p>Currently, the Progress Indicator context is the most widely used approach in the IntelliJ Platform.
As the platform's execution model moves towards <a href="launching_coroutines.md">coroutines</a>, this approach As the platform's execution model moves towards <a href="launching_coroutines.md">coroutines</a>, this approach
can be considered obsolete.</p> can be considered obsolete.</p>
<p>Starting with 2024.2, it is recommended to execute new code in the <p>Starting with 2024.2, it is recommended to execute new code in the
<a anchor="job-context-coroutines">Job context</a>.</p> <a anchor="job-context-coroutines">Job context</a>.</p>
<p id="sections-note">The following sections explain the contexts and provide information about process cancellation, progress <p>The following sections explain the contexts and provide information about process cancellation, progress
tracking, and switching between contexts.</p> tracking, and switching between contexts.</p>
<!-- TODO: I'm not convinced the Job context is a good name. Suspending or Coroutine Context would be clearer, IHMO. --> <!-- TODO: I'm not convinced the Job context is a good name. Suspending or Coroutine Context would be clearer, IHMO. -->
@ -80,12 +80,16 @@
<li><a anchor="blocking-context"/></li> <li><a anchor="blocking-context"/></li>
<li><a anchor="progress-indicator"/> — obsolete since 2024.1</li> <li><a anchor="progress-indicator"/> — obsolete since 2024.1</li>
</list> </list>
<include from="execution_contexts.topic" element-id="progress-indicator-migration-note"/>
<p>Currently, the Progress Indicator context is the most widely used approach in the IntelliJ Platform.
As the platform's execution model moves towards <a href="launching_coroutines.md">coroutines</a>, this approach
can be considered obsolete.</p>
<p>Starting with 2024.1, it is recommended to execute new code in the <p>Starting with 2024.1, it is recommended to execute new code in the
<a anchor="suspending-context-coroutines">suspending context</a>.</p> <a anchor="suspending-context-coroutines">suspending context</a>.</p>
<include from="execution_contexts.topic" element-id="sections-note"/> <p>The following sections explain the contexts and provide information about process cancellation, progress
tracking, and switching between contexts.</p>
<chapter title="Suspending Context (Coroutines)" id="suspending-context-coroutines"> <chapter title="Suspending Context (Coroutines)" id="suspending-context-coroutines">
<primary-label ref="2024.1"/> <primary-label ref="2024.1"/>
@ -173,7 +177,7 @@
</list> </list>
</td> </td>
</tr> </tr>
<tr id="cancellation-check-progress-indicator-row"> <tr>
<td>Progress&nbsp;Indicator</td> <td>Progress&nbsp;Indicator</td>
<td> <td>
<list> <list>
@ -214,7 +218,17 @@
</list> </list>
</td> </td>
</tr> </tr>
<include from="execution_contexts.topic" element-id="cancellation-check-progress-indicator-row"/> <tr>
<td>Progress&nbsp;Indicator</td>
<td>
<list>
<li><a href="%gh-ic%/platform/core-api/src/com/intellij/openapi/progress/ProgressIndicator.java">
<code>ProgressIndicator.checkCanceled()</code></a></li>
<li><a href="%gh-ic%/platform/core-api/src/com/intellij/openapi/progress/ProgressManager.java">
<code>ProgressManager.checkCanceled()</code></a></li>
</list>
</td>
</tr>
</table> </table>
</tab> </tab>
</tabs> </tabs>
@ -229,7 +243,7 @@
<table style="header-column"> <table style="header-column">
<tr> <tr>
<td width="16%">Job Context</td> <td width="16%">Job Context</td>
<td id="progress-reporting-job-context-cell"> <td>
<list> <list>
<li><a href="%gh-ic%/platform/util/progress/src/impl/ProgressStep.kt"><code>ProgressStep</code></a> <li><a href="%gh-ic%/platform/util/progress/src/impl/ProgressStep.kt"><code>ProgressStep</code></a>
- a step-based progress reporting (see its KDoc for details) - a step-based progress reporting (see its KDoc for details)
@ -261,7 +275,7 @@
</code-block> </code-block>
</td> </td>
</tr> </tr>
<tr id="progress-reporting-progress-indicator-row"> <tr>
<td>Progress&nbsp;Indicator</td> <td>Progress&nbsp;Indicator</td>
<td> <td>
<a href="%gh-ic%/platform/core-api/src/com/intellij/openapi/progress/ProgressIndicator.java"><code>ProgressIndicator</code>'s</a> <a href="%gh-ic%/platform/core-api/src/com/intellij/openapi/progress/ProgressIndicator.java"><code>ProgressIndicator</code>'s</a>
@ -278,7 +292,37 @@
<table style="header-column"> <table style="header-column">
<tr> <tr>
<td width="16%">Suspending Context</td> <td width="16%">Suspending Context</td>
<include from="execution_contexts.topic" element-id="progress-reporting-job-context-cell"/> <td>
<list>
<li><a href="%gh-ic%/platform/util/progress/src/impl/ProgressStep.kt"><code>ProgressStep</code></a>
- a step-based progress reporting (see its KDoc for details)
</li>
<li><a href="%gh-ic%/platform/util/progress/src/RawProgressReporter.kt"><code>RawProgressReporter</code></a>
- a raw text, details, and fraction reporting (invoked via <a
href="%gh-ic%/platform/util/progress/src/steps.kt"><code>reportRawProgress()</code></a>)
</li>
</list>
<p>
Any <a href="%gh-ic%/platform/util/progress/src/steps.kt"><code>report*Progress()</code></a>
function must be used inside <code>withBackgroundProgress()</code>, <code>withModalProgress()</code>,
or <code>runWithModalProgressBlocking()</code> from <a
href="%gh-ic%/platform/progress/shared/src/tasks.kt">
<path>tasks.kt</path>
</a>.
Otherwise, if there is no reporter in the context, using <code>report*Progress()</code> will
have no effect.
Example:
</p>
<code-block lang="kotlin">
withBackgroundProgress(...) { // or other
// ...
reportProgress { reporter -> // or another report*Progress
// do tasks and report progress
}
// ...
}
</code-block>
</td>
</tr> </tr>
<tr> <tr>
<td>Blocking Context</td> <td>Blocking Context</td>
@ -286,7 +330,17 @@
unavailable unavailable
</td> </td>
</tr> </tr>
<include from="execution_contexts.topic" element-id="progress-reporting-progress-indicator-row"/> <tr>
<td>Progress&nbsp;Indicator</td>
<td>
<a href="%gh-ic%/platform/core-api/src/com/intellij/openapi/progress/ProgressIndicator.java"><code>ProgressIndicator</code>'s</a>
or <a
href="%gh-ic%/platform/core-api/src/com/intellij/openapi/progress/ProgressManager.java"><code>ProgressManager</code>'s</a>
methods
<p>See <a href="background_processes.md#tracking-progress">Background Processes: Tracking
Progress</a> for details.</p>
</td>
</tr>
</table> </table>
</tab> </tab>
</tabs> </tabs>