mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-30 18:27:49 +08:00
code_intentions.md: Describe description files
This commit is contained in:
parent
3154d84816
commit
6236cfeaa5
@ -32,6 +32,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 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
|
||||
|
||||
> 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
|
||||
@ -60,6 +61,20 @@ If the cursor is positioned on the `?` conditional operator, IntelliJ IDEA propo
|
||||
|
||||
Invoking <control>SDK: Convert ternary operator to if statement</control> 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
|
||||
|
||||
The intention description is available in the UI under <ui-path>Settings | Editor | Intentions | SDK Intentions | SDK: Convert ternary operator to if statement</ui-path>.
|
||||
|
||||
The plugin provides description files in the <path>resources/intentionDescriptions/ConditionalOperatorConverter</path> directory:
|
||||
- <path>description.html</path> - provides the general information about the intention
|
||||
- <path>after.java.template</path> - shows the code fragment that intention can change
|
||||
- <path>before.java.template</path> - shows the code fragment after applying the intention
|
||||
|
||||
By default, the intention description directory name is the same as the intention class name.
|
||||
It can be customized with the `<descriptionDirectoryName>` element in `<intentionAction>` in <path>plugin.xml</path>.
|
||||
|
||||
"Before" and "after" filenames pattern is <path>before.\$LANG_FILE_EXTENSION\$.template</path> and <path>after.\$LANG_FILE_EXTENSION\$.template</path> respectively.
|
||||
|
||||
#### Testing the Plugin
|
||||
|
||||
> Please note that running the test requires setting system property `idea.home.path` in the `test` task configuration of the Gradle build script.
|
||||
|
Loading…
x
Reference in New Issue
Block a user