Add information about ordering intentions and quick fixes with HighPriorityAction and LowPriorityAction

This commit is contained in:
Karol Lewandowski 2023-09-05 15:34:32 +02:00
parent e11b487e3a
commit 45584e7782
2 changed files with 20 additions and 2 deletions

View File

@ -98,6 +98,15 @@ The change to the PSI tree is accomplished by the usual approach to modification
* Substituting the original left and right operands into the new `PsiMethodCallExpression`.
* Replacing the original binary expression with the `PsiMethodCallExpression`.
> In case of providing multiple quick fixes for a single element, their ordering is indeterministic due to performance reasons.
> It is possible to push specific items up or down by implementing
> [`HighPriorityAction`](%gh-ic%/platform/analysis-api/src/com/intellij/codeInsight/intention/HighPriorityAction.java)
> or
> [`LowPriorityAction`](%gh-ic%/platform/analysis-api/src/com/intellij/codeInsight/intention/LowPriorityAction.java)
> respectively.
>
{style="note"}
### Inspection Description
The inspection description is an HTML file.

View File

@ -1,7 +1,7 @@
# Intentions
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# Intentions
<link-summary>Intention actions allowing to fix code issues or transform the code to a different form.</link-summary>
<tldr>
@ -33,6 +33,15 @@ The [conditional_operator_intention](%gh-sdk-samples%/conditional_operator_inten
- How to invoke a quick fix action for a token element under cursor using the [`PsiElementBaseIntentionAction`](%gh-ic%/platform/lang-api/src/com/intellij/codeInsight/intention/PsiElementBaseIntentionAction.java) class.
- How to create a JUnit test for this plugin using the [`IdeaTestFixtureFactory`](%gh-ic%/platform/testFramework/src/com/intellij/testFramework/fixtures/IdeaTestFixtureFactory.java) class.
> In case of providing multiple intention actions for a single element, their ordering is indeterministic due to performance reasons.
> It is possible to push specific items up or down by implementing
> [`HighPriorityAction`](%gh-ic%/platform/analysis-api/src/com/intellij/codeInsight/intention/HighPriorityAction.java)
> or
> [`LowPriorityAction`](%gh-ic%/platform/analysis-api/src/com/intellij/codeInsight/intention/LowPriorityAction.java)
> respectively.
>
{style="note"}
## Sample Plugin
When launched, this plugin adds the <control>Convert ternary operator if statement</control> item to the <control>Conditional Operator</control> node in the Intentions List: