From 63947c2c46ac0f01776aea18d9fa9f6aa64e6b49 Mon Sep 17 00:00:00 2001 From: Vladimir Petrenko Date: Mon, 27 Jan 2025 14:42:41 +0100 Subject: [PATCH] code_intentions.md: edit considering Intentions Actions Preview feature (#1417) purpose: - make it clearer that "before/after examples" and "intention action preview" are different things. - simplify navigation to "Intention Action Preview" topic --- topics/tutorials/code_intentions.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/topics/tutorials/code_intentions.md b/topics/tutorials/code_intentions.md index 96ccccfea..1c2a536b7 100644 --- a/topics/tutorials/code_intentions.md +++ b/topics/tutorials/code_intentions.md @@ -24,6 +24,8 @@ See the [Inspections](inspections.md) topic in UI Guidelines on naming, writing You can view a list of all available intention actions as well as enable/disable them using the [Intentions List](https://www.jetbrains.com/help/idea/intention-actions.html#intention-settings) in Settings | Editor | Intentions. +See the [Intention Action Preview](code_intentions_preview.md) topic on providing a preview of changes that can be made by executing an intention. + ## Techniques Used The [conditional_operator_intention](%gh-sdk-samples-master%/conditional_operator_intention) sample plugin illustrates the use of the following techniques: @@ -32,7 +34,7 @@ The [conditional_operator_intention](%gh-sdk-samples-master%/conditional_operato - How to find a Java token of interest in the PSI tree. - How to invoke a quick-fix action for a token element under the 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. -- How to add an intention description and before/after examples +- How to add an intention description and before/after examples in the Settings dialog > In the 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 @@ -61,11 +63,17 @@ If the cursor is positioned on the `?` conditional operator, IntelliJ IDEA propo Invoking SDK: Convert ternary operator to if statement intention action will result in transforming expression to the form visible in the [preview](code_intentions_preview.md) popup (code fragment on the right). -#### Intention Description +#### Intention Description and examples -The intention description is available in the UI under Settings | Editor | Intentions | SDK Intentions | SDK: Convert ternary operator to if statement. +The intention description is available in the UI in two places: +- under Settings | Editor | Intentions | SDK Intentions | SDK: Convert ternary operator to if statement. +- near the selected intention action in the [Context Actions](https://www.jetbrains.com/help/idea/intention-actions.html#apply-intention-actions) popup +in the editor when [Preview](code_intentions_preview.md) cannot be shown. -The plugin provides description files in the resources/intentionDescriptions/ConditionalOperatorConverter directory: +The before/after examples are available in the UI +under Settings | Editor | Intentions | SDK Intentions | SDK: Convert ternary operator to if statement. + +The plugin provides description and before/after examples files in the resources/intentionDescriptions/ConditionalOperatorConverter directory: - description.html - provides the general information about the intention - after.java.template - shows the code fragment that intention can change - before.java.template - shows the code fragment after applying the intention